bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

sed feature request


From: Eric Heitzman
Subject: sed feature request
Date: Wed, 24 Sep 2003 15:15:22 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624

The GNU version of "sed" appears to lack the ability to edit files inline. If I want to use sed to modify 100 files in a directory, there seems to be no way to modify the files in place. Instead, I have to write a script which runs sed against a file, saves the output in a temporary file, and then copies the temporary over the original. Then if I have a whole bunch of files in a directory, I would have to write another script to repeatedly call to use this "one file at a time" version of sed. This seems silly, so I think I'm probably just missing something about how sed should be properly used.

The BSD version of said includes a -i switch which permits inline editing. You can specify a file extension, which causes sed to write the output of each modified file out to a new file with the same name, with the additional extension appended. If omit the extension, the source file is used as the target file.

Eric





reply via email to

[Prev in Thread] Current Thread [Next in Thread]