$original = "c:\\myfile.txt";
$changed = "c:\\mynewfile.txt";

$searchfor = "john"; # Text identifying line(s) you want removing

open IN, $original or die "Can't open $original: $!";
open OUT, ">$changed" or die "Can't create $changed: $!";

while(<IN>) {
        print OUT unless /$changed/;
}

close IN;
close OUT;

HTH

John


-----Original Message-----
From: Deepesh Tiwari [mailto:[EMAIL PROTECTED]]
Sent: 28 June 2001 16:13
To: [EMAIL PROTECTED]
Subject: deleting a line with a particular string.


---
I have a file having 100 lines.
I want to remove the lines, having a particular string, completely from the
file. (notreplacing them with blank lines even)

Is there a way in perl for doing this ?

--deepesh



--------------------------Confidentiality--------------------------.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.


Reply via email to