frenomulax
asked on
regexp question
Novice question here...
How can I open a file, entirely remove all lines which start w/ 'Path: ' (without the quotes), and write the file to a new filename. I have tried several variations on this code:
#!/usr/bin/perl
open NEWSFILE, "<news_file.txt" or die "Can't open news_file.txt";
open TEMPFILE, ">temp_file.txt" or die "Can't open temp_file.txt";
while (<NEWSFILE>) {
tr/Path: //;
print TEMPFILE;
}
close TEMPFILE;
close NEWSFILE;
but no luck.
thanks
How can I open a file, entirely remove all lines which start w/ 'Path: ' (without the quotes), and write the file to a new filename. I have tried several variations on this code:
#!/usr/bin/perl
open NEWSFILE, "<news_file.txt" or die "Can't open news_file.txt";
open TEMPFILE, ">temp_file.txt" or die "Can't open temp_file.txt";
while (<NEWSFILE>) {
tr/Path: //;
print TEMPFILE;
}
close TEMPFILE;
close NEWSFILE;
but no luck.
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER