如将当前目录下的所有.c和.h中的aaaa替换成bbbb: sed -i "s/aaaa/bbbb/g" `ls *.c *.h` 去除行尾的空格和tab: sed -i 's/[ \t]*$//g' test.c