How can I get only the filename using sed? I've this
out_file=$(echo $in_file|sed "s/\(.*\.\).*/\1mp4/g")
But I get the path too /root/video.mp4, and I want only video.mp4.
|
|
|
If you already know the extension of the file, you can invoke
Or another option would be cutting everything after the last dot using
|
|||||
|
|
Use any of the followings ways:
ps. You get the same string because in your statement Update: To get the only filename without extension you can :
|
|||||||||||
|
|
The easiest solution is remove everything until last appearance of
|
|||
|
|