How get the file in these strings?
/home/streaming/demo/youtube/Surf9B.mp4
/home/streaming/demo/Surf9B.mp4
/home/streaming/demo/youtube/test/Surf9B.mp4
I need to get only the Surf9B.mp4
and store in a new variable.
How get the file in these strings?
/home/streaming/demo/youtube/Surf9B.mp4
/home/streaming/demo/Surf9B.mp4
/home/streaming/demo/youtube/test/Surf9B.mp4
I need to get only the Surf9B.mp4
and store in a new variable.
$ basename /home/streaming/demo/youtube/Surf9B.mp4
Surf9B.mp4
$ file=`basename /home/streaming/demo/youtube/Surf9B.mp4`
$ echo "$file"
Surf9B.mp4
You could try something like this, but you names cannot include a "/" in them.
SOME_VAR=$(echo "/home/streaming/demo/youtube/Surf9B.mp4" | rev | cut -f1 -d'/' | rev)
echo $SOME_VAR