bash eliminate second last of the seperated string
Hi I would like to have:
/mnt/main/dir1/dir2/file.ext to /mnt/main/dir/ I have tried: fname="${file#*/}" and bdir=$(echo "$file" | awk -F / '{if (NF>2) {print $NF}}') seems like I am not getting the solution, Thanks, Ted. |
does this help:
Code:
[schneidz@hyper ~]$ d1=`dirname /mnt/main/dir1/dir2/file.ext` |
This will do it
Code:
file=/mnt/main/dir1/dir2/file.ext |
Thanks,
Ted |
All times are GMT -5. The time now is 02:32 PM. |