Let's say I have a file with the following contents:
VSDmaMapInfo
VSDmaMapInfo::
VSDmaMapInfo;
VSPortErr
VSPortErr,
VSPortErr::
and after sorting I wanted the output to be
VSDmaMapInfo
VSPortErr
Is there any way to do it using either grep, awk, uniq,or any other tools etc
Thanks a lot for your help.
$ awk -F'[[:punct:]]' '{print $1}' file | sort -u
VSDmaMapInfo
VSPortErr
Code for sorted content with GNU sed
sed -r '$!N;/(\w+)\W*\n\1\W*/!{s/(\w+).*/\1/;P};D' file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With