parse special character in the line

Hi all,

I have a file with some module names as below.

Font::AFM
Data::Grove ---> libxml-perl
Net::LDAP ---> perl-ldap
DBI
XML
....
...
....

and so on ...

The file has some lines with the character " -->" .
Now how can I cut only the last column of the line wherever "-->" is found and keep others as it is in its place.

o/p should be like:
---------------
Font::AFM
libxml-perl
perl-ldap
DBI
XML
...
...

Is there way other than using using while read line and redirecting the line to some other file? Any simpler means using sed or awk ??

Thanks in advance. :b::b:

awk '/--->/{sub(".*> ","");print;next}1' file

Always the last field?

awk '{print $NF}' file
sed -i data.file -e 's/.*-> //g'

Hi bartus11,
Thanks a lot. It worked for me :slight_smile: