Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

sed

Name: Anonymous 2005-08-14 9:25

I just tried "sed"ing a file and redirecting the output back into the same file, but it ends up creating an empty file. How do I do this without using a temporary file and renaming the result?

Name: Anonymous 2005-08-14 9:54

I don't think you can.

You might be able to pull it off by sed < file > file, but I doubt it.

Name: Anonymous 2005-08-14 10:15

I would have expected this to be easy, since I would imagine altering a file in place would be one of the more common usages of sed. Amirong?

Name: Anonymous 2005-08-14 14:12

Try <file >file.tmp then delete file and move file.tmp to file

Name: Anonymous 2005-08-14 15:16

nm I figured it out; you use the -i option.

Don't change these.
Name: Email:
Entire Thread Thread List