Perlwannabe wrote: > > OK, I have a new problem. I need to delete an entire line that contains > certain text. I have done an extensive search and had no luck finding an > adequate answer. Yes, I also saw the FAQ that just refers me to > Tie::file. The most promising solution was: > > perl -ni.bak -e 'print unless /FOO/;' input.txt > > but when I run that line from the c:\ I get the following error: > > Can't find string terminator "'" anywhere before EOF at -e line 1.
That is because the Windows command interpreter doesn't like single quotes, you have to use double quotes. perldoc -q "Why don't Perl one-liners work on my DOS/Mac/VMS system" > Also, I would like to run this from within a script instead of from the > command line. > > BTW...using PERL 5.8.0 on Windows2000 Pro Here is one way to do it: use warnings; use strict; my $file = shift or die "usage: $0 filename\n"; rename $file, "$file.bak" or die "Cannot move $file to $file.bak: $!"; open my $in, '<', "$file.bak" or die "Cannot open $file.bak: $!"; open my $out, '>', $file or die "Cannot open $file: $!"; while ( <$in> ) { print $out unless /FOO/; } __END__ John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]