#!/usr/mbari/bin/perl -w $replaced = 0; $count = 0; unless ($ARGV[0]) { print "\nThis script is to modify the header files with the current deployment date.\n"; print "The program's FIRST argument is the path to the headers and the SECOND argument is the deployment date.\n"; print 'Enter the new deployment date in quotes, ie. "19 Aug 1999". If a date is NOT specified the system date is used.'; print "\n\n"; exit; } if ($ARGV[0] eq "-h") { print "We are the champions.\n"; exit; } $dir = $ARGV[0]; $dir = defined($dir) ? $dir : '.'; opendir(D,$dir); $find = Deployment; $replace = "Deployment date"; $date = `date`; if ($ARGV[1]) { $date = $ARGV[1]; } @files = grep(/\.hdr/,readdir(D)); for(@files) { open(IN,$_); undef $/; $file = ; if ($file =~ s/$find.*\n/$replace $date/) { $replaced++; } $count++; open(OUT,">$_"); print OUT $file; } close(IN); close(OUT); print "$count files searched.\n"; print "$replaced strings replaced.\n";