#!c:/perl/bin/perl
# Perl script that will take as input from a file, produce as output to STDOUT;
# lines in input will be copied to ouput, except for the following transformations:
#
# 1. any line with the string "IgNore" in it will not go to output
# 2. any line with the string "#" in it will have that character and all characters
# after it, to end of line, removed
# 3. any string "*DATA*" will be replaced by the current date in output
$arg_num = @ARGV;
($arg_num > 0) || die ("No file specified to be processed\n");
open(INFILE, $ARGV[0]) || die ("Can not open file $ARGV[0]");
chop($date = `date`); #run system command, remove newline at the end
while($line = <INFILE>)
{
if($line =~ /IgNore/)
{
next;
}
$line =~ s/\*DATE\*/$date/g;
if($line =~ /([^\#]*)\#.*/)
{
$line = $1;
}
print $line;
}
close(INFLIE); #don't forget to close it