I want to print 1 version of Duplicates and remove unique lines in bash linux -


the input follows:

mark john marry mark john 

and output should be:

mark john 

how in bash file linux.

sort | uniq -d 

for example:

$ cat file mark john marry mark john   $ cat file | sort | uniq -d john mark 

to preserve order, can use more obscure awk command:

$ awk 'a[$0]++ == 1' file mark john 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

c# - How do I get the Nth largest element from a list with duplicates, using LINQ? -

jsp - "Sending a redirect is forbidden after the response has been committed" in sendRedirect -