Use sed to delete all leading/following blank spaces in a text file

后端 未结 4 1974
小蘑菇
小蘑菇 2020-12-16 02:04

File1:

  hello  
  world  

How would one delete the leading/trailing blank spaces within this file using sed - using one command (n

4条回答
  •  既然无缘
    2020-12-16 02:24

    easier way, using awk

    awk '{$1=$1}1' file
    

    or

    awk '{gsub(/^ +|  +$/,"")}1' file
    

提交回复
热议问题