Needed value after the last delimeter in a file with varying number of delimited columns

Hi All,
My file has the records as below:

aaa\bbb\c\dd\ee\ff\gg
zz\vv\ww
pp\oo\ii\uu

How can I get the value after the last delimeter.

My o/p:

gg
ww
uu

Thanks in Advance,

sed 's/.*\\\(.*\)/\1/' inputfile

There're several posts on this. Did you try searching the forum?

Hi,
you can try with this

$ echo "xx\zz\yy"|awk -F\\  '{print $NF}'
yy
$ echo "xx\zz\yy\ss"|awk -F\\  '{print $NF}'
ss

thanks,
venkat

cat file | awk -F'\' '{print $NF}'

awk (and sed) will both accept a filename as a parameter - you don't need cat.

awk -F'\' '{print $NF}' file

Old habits die hard.. Can't get rid of this habit really :frowning:

But I guess that code will work..