How do I make a backup of a file when editing with sed?
-
Also see:
sed(1) - stream editor for filtering and transforming text-i[SUFFIX], --in-place[=SUFFIX] edit files in place (makes backup if SUFFIX supplied)
Using the
-i
option add a suffix. This will create a backup file called breakfastbackup$ sed -ibackup '/coffee/d' breakfast
© Lightnetics 2024