要剪切字符串中的最后一个字段,我使用:
command: echo /dir1/dir2/dir3/file | awk -F "/" '{ print $NF; }'
output: file
Run Code Online (Sandbox Code Playgroud)
如何获取同一字符串中最后一个分隔符左侧的所有内容?
desired output: /dir1/dir2/dir3
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助
拉斯蒂