Delete everything before last / in bash

后端 未结 4 2081
无人共我
无人共我 2021-01-04 22:48

I have many file paths in a file that look like so:

/home/rtz11/files/testfiles/547/prob547455_01

I want to use a bash script that will pri

4条回答
  •  心在旅途
    2021-01-04 23:29

    Meandering but simply because I can remember the syntax I use:

    cat file | rev | cut -d/ -f1 | rev
    

    Many ways to skin a 'cat'. Ouch.

提交回复
热议问题