Quantcast
Viewing all articles
Browse latest Browse all 5

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

Another way with Bash (also two steps).

IFS=/ read -a array <<<'/dir0/dir1/dir2/filename.ext'
echo ${array[ $(( ${#array[@]}-2 )) ]}
dir2

Viewing all articles
Browse latest Browse all 5

Trending Articles