vi test.txt
My name is chaoge.
I teach linux.
I like play computer game.
My qq is 877348180.
My website is http://pythonav.cn.
sed -n "2,3p" test.txt # print2,3行
sed -i "/game/d" test.txt # delete匹配的game行
sed -i "s/I/MY/g" test.txt # 将所有的I改为MY
sed -i "2a MY linux" test.txt# 在第2行后追加内容add
shell_三剑客sed
于 2025-04-04 12:37:46 首次发布