我有一个包含以下行的文件(由空格分隔的 3 个字段):
component1 /dev/user/test 12344
component2 master abcefa123
component3 trunk 72812
component4 /branch/user/integration bc89fa
component5 trunk 989091
component6 integration/test bc7829ac
component7 /branch/dev/user/various eded34512
我需要操纵字段 2 以削减其长前缀(与在 bash 中使用 ${string##*} 所做的相同)并获得以下结果:
component1 test 12344
component2 master abcefa123
component3 trunk 72812
component4 integration bc89fa
component5 trunk 989091
component6 test bc7829ac
component7 various eded34512
我不知道该怎么做。