In-Place Editing

noun

say it: “IN PLAYSS ED-ih-ting” /ɪn ˈpleɪs ˈɛdɪtɪŋ/

Changing a file itself, rather than printing a changed copy of its text.

What is in-place editing?

In-place editing writes a change back into the file itself instead of printing the changed text. sed -i does it, and sed -i.bak keeps each old version beside it with .bak on the end. Run the command without -i first and read what it prints.

sed 's|/|-|g' specials/monday.txt          # look first
sed -i.bak 's|/|-|g' specials/*.txt       # then change the files

In a sentence

  • “With in-place editing, sed -i.bak kept each old page beside it as a .bak file.”
  • “sed -i does in-place editing, so Sam checked the output without -i first.”

Level: Apprentice · More Unix terms at this level

Updated