gang,
# problem: open a file
# find lines that meet a condition, put them in an output file
Could you share some patterns/sample code that you use to accomplish this
task? What pattern do you use when the output file doesn't exist when the
script begins?
The code below errors with:
C:\WINNT\Profiles\rem27920\Desktop\perl>remove_lines.pl
syntax error at C:\WINNT\Profiles\rem\Desktop\perl\remove_lines.pl line 7,
near ", >"
Execution of C:\WINNT\Profiles\rem\Desktop\perl\remove_lines.pl aborted due
to compilation
errors.
#!c:/perl/bin/perl -w
use strict;
my $file = 'c:/winnt/profiles/rem/desktop/old_websites.txt';
my $outfile = 'c:/winnt/profiles/rem/desktop/old_web2.txt';
open(INFO, "$file") or die "$!"; # file open w/error check
open(RESULT, >$outfile); # tried "$outfile" as well...
my @lines = grep { ! /_vti_cnf/ } <INFO>;
while (<INFO>) {
print RESULT;
}
#print (@lines, $outfile ); # prints lines to STDOUT, and the filename
# print (join "\n", @lines); # print files, one per line
close INFO;
close RESULT;
thank you,
Rob
--
Rob McCormick
[EMAIL PROTECTED]