How to remove the first part of a string in bash?

前端 未结 5 810
一向
一向 2021-02-07 05:48

This code will give the first part, but how to remove it, and get the whole string without the first part?

echo \"first second third etc\"|cut -d \" \" -f1
         


        
5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-07 05:55

    You can use substring removal for that, no need for external tools:

    $ foo="a b c d"
    $ echo "${foo#* }"
    b c d
    

提交回复
热议问题