1、
[root@linuxprobe test]# ls ## 测试数据 a.txt [root@linuxprobe test]# cat a.txt fd gfd fgd fsdafds dfs sff [root@linuxprobe test]# cat -A a.txt ^I^Ifd gfd fgd $ fsdafds^I^I$ ^I^I dfs ^I^I$ sff^I^I$ [root@linuxprobe test]# sed -n l a.txt \t\tfd gfd fgd $ fsdafds\t\t$ \t\t dfs \t\t$ sff\t\t$
2、
[root@linuxprobe test]# sed 's/^[\t ]*\|[\t ]*$//g' a.txt fd gfd fgd fsdafds dfs sff [root@linuxprobe test]# sed 's/^[\t ]*\|[\t ]*$//g' a.txt | cat -A fd gfd fgd$ fsdafds$ dfs$ sff$