Shell Removing Tabs/Spaces

前端 未结 6 1741
醉酒成梦
醉酒成梦 2021-02-20 18:45

I\'ve used a grep command with sed and cut filters that basically turns my output to something similar to this

    this line 1


    this line 2


    another li         


        
6条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-20 18:53

    You can also use grep:

    ... | grep -o '[^$(printf '\t') ].*' 
    

    Here we print lines that have at least one character that isn't white space. By using the "-o" flag, we print only the match, and we force the match to start on a non white space character.

    EDIT: Changed command so it can remove the leading white space characters.

    Hope this helps =)

提交回复
热议问题