Depending on the version of sed
on your system you may be able to do
sed -i 's/Some/any/; s/item/stuff/' file
You don't need the g
after the final slash in the s
command here, since you're only doing one replacement per line.
Alternatively:
sed -i -e 's/Some/any/' -e 's/item/stuff/' file
Or:
sed -i ' s/Some/any/ s/item/stuff/' file
The -i
option (a GNU extension now supported by a few other implementations though some need -i ''
instead) tells sed
to edit files in place; if there are characters immediately after the -i
then sed
makes a backup of the original file and uses those characters as the backup file's extension. Eg,
sed -i.bak 's/Some/any/; s/item/stuff/' file
or
sed -i'.bak''s/Some/any/; s/item/stuff/' file
will modify file
, saving the original to file.bak
.
Of course, on a Unix (or Unix-like) system, we normally use '~' rather than '.bak', so
sed -i~ 's/Some/any/;s/item/stuff/' file