Wednesday, July 14, 2010

sed replace in place

GNU sed has a -i option, that allows users to replace/modify in place.

For a more portable option, that would also work in Unix, you need to do:


/bin/sed -e "$line\d" file > file.temp
/bin/mv file.temp file




No comments:

Post a Comment