Shell Removing Tabs/Spaces

前端 未结 6 1591
醉酒成梦
醉酒成梦 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:56

    This can be done with the tr command as well. Like so

    | tr -s [:space:]

    or alternatively

    | tr -s \\n

    if you want to remove the line breaks only, without the space chars in the beginning of each line.

提交回复
热议问题