Hi all,
I have a 10.txt file. In this file 2 words are present by name Active and Inactive and these words are repeated 7000 times. I want to take the unique 2 words from this 7000 lines.
Thanks
Mahalakshmi.A
Hi all,
I have a 10.txt file. In this file 2 words are present by name Active and Inactive and these words are repeated 7000 times. I want to take the unique 2 words from this 7000 lines.
Thanks
Mahalakshmi.A
Although your question is not clear, a sample input/output would help. But I'll assume that you want extract unique names from the first column of your input file:
sort -k 1,1 -u inputfile
Above will give you the last occurrence of names.
It's working fine. I would like to know about the -u -k optiosn in the sort command. Could you please explain.
thanks
-k 1,1 sort the content of inputfile using first column as the primary sort key and -u is there to display uniq values only. Read the man sort for more details.