-4

how can I list the identical words from below file using shell script ?

list.txt

LT
R
LT
MRTD
LT
MK
RR
RR

example result :

LT
R
MRTD
MK
RR
ara
  • 11
  • 1
  • 2
  • 1
    Your example result doesn't make sense R,MRTD and MK aren't duplicated ? Your Example result shows the unique 'words'. Please clarify your requirements. – user9517 Jul 18 '12 at 07:04

2 Answers2

0

Use sort, and uniq like this:

 cat list.txt | sort | uniq
Stone
  • 7,011
  • 1
  • 21
  • 33
0

sort also has the --unique option:

$ sort -u list.txt
quanta
  • 51,413
  • 19
  • 159
  • 217