Quantcast
Channel: How to get string between the last two "/" symbols - Super User
Viewing all articles
Browse latest Browse all 5

Answer by Vipul for How to get string between the last two "/" symbols

$
0
0

Solved it using awk :

echo "/dir0/dir1/dir2/filename.ext" | awk -F'/' '{print $(NF-1)}'

The output of above will be:

dir2

Viewing all articles
Browse latest Browse all 5

Trending Articles