I have a file in Solaris. The following is a sample from the file:
CELLO;998;CMGW4;20070926;1030;00000000;0000;15;/cpm_data;172.20.19.5;22;ON;true;UTC+06:00;Etc/GMT-6
CELLO;999;CMGW1;20070920;1730;00000000;0000;15;/cpm_data;172.20.11.4;21;OFF;true;UTC+06:00;Etc/GMT-6
CELLO;999;CMGW3;20070629;1845;00000000;0000;15;/cpm_data;172.20.19.4;22;ON;true;UTC+06:00;Etc/GMT-6
CELLO;999;CMGW4;20070926;1130;00000000;0000;15;/cpm_data;172.20.19.5;22;ON;true;UTC+06:00;Etc/GMT-6
CELLO;99;CMGW5;20070930;1630;00000000;0000;15;/cpm_data;172.20.11.6;22;ON;true;UTC+06:00;Etc/GMT-6
CELLO;9;CMGW4;20120330;1215;00000000;0000;15;/cpm_data;172.20.19.5;22;ON;true;UTC+06:00;Etc/GMT-6
I am interested in the 3rd column (separated by ;) i.e the filed starting with CMGW. I want to get only the 3rd column unique values. Considering the sample above, the output that I want is:
CMGW1
CMGW3
CMGW4
CMGW5
Any help is appreciated.
You can do it like this:
awk -F\; '{print $3}' data | sort -u
Where data
is the name of your data file.