Re: Delete a line and replace

2002-05-13 Thread Sudarsan Raghavan
d.bak"; #remove the temp file > > ## > > So the one real difference is that instead of creating a copy in memory, we > have to create a temporary file to hold the contents of our changes. > > -Original Message- > From: Langa Kentane > To: 'Timothy

RE: Delete a line and replace

2002-05-13 Thread Timothy Johnson
### So the one real difference is that instead of creating a copy in memory, we have to create a temporary file to hold the contents of our changes. -Original Message- From: Langa Kentane To: 'Timothy Johnson' Sent: 5/13/02 10:54 PM Subject: RE: Delete a line and replace Hi J

RE: Delete a line and replace

2002-05-13 Thread Timothy Johnson
You can try something like this: open(INFILE,"/etc/passwd"); @infile = ; #don't do this if your file gets big close INFILE; foreach(@infile){ if($_ =~ /^ftp/i){ #if it starts with "ftp" $_ = '';#make it a zero-length string }elsif($_ =~ /guest/i){ #else if it contains "guest"