1、将当前目录下包含hello串的文件中,1字符串替换为2
sed -i 's/1/2/g' `grep "1" -rl ./`
2、将某个文件中的hello字符串替换为hi
sed -i "s/1/2/g" test.txt
3、删除行首空格
sed -i 's/^ //g' test.txt
4、删除行尾空格
sed -i 's/ $//g' test.txt
1、将当前目录下包含hello串的文件中,1字符串替换为2
sed -i 's/1/2/g' `grep "1" -rl ./`
2、将某个文件中的hello字符串替换为hi
sed -i "s/1/2/g" test.txt
3、删除行首空格
sed -i 's/^ //g' test.txt
4、删除行尾空格
sed -i 's/ $//g' test.txt