now I have a string
.a/b/c/done
I want to get "done" from it. That is the result should be "done"
sorry for my language before.
Thanks in advance
now I have a string
.a/b/c/done
I want to get "done" from it. That is the result should be "done"
sorry for my language before.
Thanks in advance
Hi Henryyy,
One way:
$ str=".a/b/c/done"
$ echo "${str%/*}"
.a/b/c
Regards,
Birei
Sorry for my language, I correct the question.
But thank you all the same
Then, try:
$ str=".a/b/c/done"
$ echo "${str##*/}"
done
Regards,
Birei
If you're working with directories and want to strip the filename, try this:
$ basename .a/b/c/done
done
echo ".a/b/c/done | "awk -F"/" '{print $NF}'
or
echo ".a/b/c/done | sed 's|.*/\(.*\)|\1|g'