How to cut a string after a specific character in unix

前端 未结 7 671
说谎
说谎 2020-12-08 14:30

So I have this string:

$var=server@10.200.200.20:/home/some/directory/file

I just want to extract the directory address meaning I only wan

7条回答
  •  醉话见心
    2020-12-08 14:50

    This should do the trick:

    $ echo "$var" | awk -F':' '{print $NF}'
    /home/some/directory/file
    

提交回复
热议问题