cutting part of string

Hi,

I wanted to cut a specific portion from given string. How would I do that?
Example:
/u09/core/inbound/abc.txt is my string.
I want abc.txt in a variable.

Please help me.

Regards,
Dhaval

var=`basename /u09/core/inbound/abc.txt`
echo $var

I believe this question had been answered many times if I am not making assumptions wrongly.

It looks like your strings are paths to files (or directories). If this is always the case the easiest method is to use basename and dirname. eg:

$ dirname /u09/core/inbound/abc.txt
/u09/core/inbound
$ basename /u09/core/inbound/abc.txt
abc.txt

Basically these utilities split and give you everything before and after the last '/' in the string. If your strings are different please qualify.

Hi,

Thanks very much. I tried to search it out from previous messages, but I could not found it.

Best Regards,
Dhaval