Remove part of path on Unix

前端 未结 7 1168
滥情空心
滥情空心 2020-11-30 21:56

I\'m trying to remove part of the path in a string. I have the path:

/path/to/file/drive/file/path/

I want to remove the first part /

7条回答
  •  情深已故
    2020-11-30 22:25

    One way to do this with sed is

    echo /path/to/file/drive/file/path/ | sed 's:^/path/to/file/drive/::'
    

提交回复
热议问题