On Sat, Dec 14, 2002 at 03:56:04AM -0500, Jim wrote:

> perl -p -i -e 's/\r\n/\n/g' file_to_remove_those_pesky_^Ms_from
> 
> Perl one-liners rule. :)  This will do it without making the second file.

That depends on what you mean by "without making the second file".

If the goal is to never have the old and new files on disk at the same
time, this won't do it.

> | so i guess what i'm gunna do is open the file, read in a line, search for
> | "\r\n", if its there, replace it with just "\n", then write the new
> | (edited) line to a new file.  my problem is this...if the file is 10 megs,
> | then not only is the program gunna read a 10 meg file, but write one as
> | well.  is there not a better way to do this?

That's the standard way of doing things.  Is this really a problem?
What are you worried about?  Disk space?  Speed wrt IO?  Something else?

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to