Sed (Stream EDitor) replacement string

sed   -i  's/original/new/g'

Detailed description:

  • sed = Stream EDitor (Stream Editor)
  • -i = in-place (ie save back to the original file) (write back source is replaced file)
  • The command string:

    • s = the substitute command
    • original = a regular expression describing the word to replace (or just the word itself)(被替换)
    • new = the text to replace it with (replace it)
    • g = global (i.e. replace all and not just the first occurrence) (全部替换)
  • file.txt = the file name

Guess you like

Origin blog.csdn.net/VoiceRoom/article/details/107975349