[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: change file contents using perl



On Thu, 16 Nov 2000, Anand D Sankruthi wrote:

> Hi all,
> I have a set of 6 lines in a file. i want to replace all these lines by a
> set of new lines (which is a subset of the old lines). can any one tell me
> the easiest way of doing this using perl??
> 

perl -pi -e 's/^.*\n$/\n/g;' file

The above replaces all lines in 'file' with a newline.

Sreeji