1. Sed的help 鸟哥说的 学东西 先看 help 先看man 再google 不好FQ再百度.. Usage: sed [OPTION]... {script-only-if-no-other-script} [input-file]... -n, --quiet, --silent suppress automatic printing of pattern space -e script, --expression=script add the script to the comma…
sed -i :直接修改读取的文件内容,而不是输出到终端. sed -i 就是直接对文本文件进行操作的 替换每行第一次出现的字符串 sed -i 's/查找的字符串/替换的字符串/' 文件 替换文件中所有出现过的字符串 sed -i 's/查找的字符串/替换的字符串/g' 文件 例如,将文件GAOWEILIUSHI_201809_084中的|全部替换为|| sed -i 's/|/||/g' GAOWEILIUSHI_201809_084 sed -i 's/d/7523/'…
格式: sed -i "s/查找字段/替换字段/g" `grep 查找字段 -rl 路径` linux sed 批量替换多个文件中的字符串 sed -i "s/oldstring/newstring/g" `grep oldstring -rl yourdir` 例如:替换/home下所有文件中的www.admin99.net为admin99.net sed -i "s/www.admin99.net/admin99.net/g" `grep w…