-----Original Message----- >From: Subhash <[EMAIL PROTECTED]> >Sent: Aug 8, 2007 10:34 PM >To: beginners@perl.org >Subject: Replacing the n'th line with the new line > >Hi > >Is there any way to update the specified line in the file with the new >line without having to copy the entire contents once again. Since the >file is huge, i dont want to re-write the file. Can anyone suggest me >how to do this >
Using one-line perl could do it,but it actually re-wrote the file. like: perl -pi -e '$i++;s/^.*$/something/ if $i==10' your_file here replace your_file's No.10 line with 'something'. Good luck! -- Jeff Pang <[EMAIL PROTECTED]> http://home.arcor.de/jeffpang/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/