Link to home
Start Free TrialLog in
Avatar of frenomulax
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
ASKER CERTIFIED SOLUTION
Avatar of jkstill
jkstill

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of frenomulax
frenomulax

ASKER

Thanks, just what I wanted.