按行对文本内容进行处理,默认处理过程在缓存中进行,不会对原始文件造成破坏。
sed 's/hello/well/g' test.txt 说明: s:替换操作 hello:原始串 :替换串 g:每一行中的所有字符串全部替换为字符串
sed -i 's/hello/well/g' test.txt 说明: -i:直接替换原始文件内容,原始文件被更改并记录 s:替换操作 hello:原始串 well:替换串 g:每一行中的所有字符串全部替换为字符串

sed 's/^[0-9][0-9]*//g' test.txt 说明: s:替换操作 ^[0-9][0-9]*:原始串匹配正则表达式 //:替换为空 g:每一行中的所有的数字字符串全部替换为空 字符串
