Sed(Stream EDitor)替换字符串

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

详细说明:

  • sed = Stream EDitor(Stream编辑)
  • -i = in-place (i.e. save back to the original 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 (替换为)
    • g = global (i.e. replace all and not just the first occurrence) (全部替换)
  • file.txt = the file name

猜你喜欢

转载自blog.csdn.net/VoiceRoom/article/details/107975349