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$

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-14
  • 2021-07-26
  • 2022-12-23
  • 2022-12-23
  • 2021-06-06
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
  • 2022-12-23
  • 2021-07-26
  • 2022-12-23
  • 2021-11-17
相关资源
相似解决方案