Hi All,
This is Ram. I'm new to this forum & new to shell scripts as well. I've a requirement in which I want to extract a substring from a given string based on last occurance of a character.
for eg.
I have a string of a file name with absolute path like
$filename=/aaa/bbb/ccc/ddd/xyz.txt
I want to extract only the actual file name ie, xyz.txt
The no. of directories ie, / will be dynamic. So I want to find the last occurance of / in the given string & to extract the string after the last /
can I have some ideas / suggestions please.
Thanks ,
Ram.