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

本文深入解析了sed命令的使用方法,包括其基本语法、参数选项以及实际应用案例。sed,即Stream Editor,是一种强大的文本处理工具,能够实现文本的查找、替换、删除、插入等操作,特别适用于批量修改文件内容。文章重点介绍了如何使用-i选项进行原地编辑,以及s命令的全局替换功能。
替换字符串&spm=1001.2101.3001.5002&articleId=107975349&d=1&t=3&u=1bdb1395bdc14a418e9d84db1b0c6231)

被折叠的 条评论
为什么被折叠?



