Find Duplicate/Repeated or Unique words in file spanning across multiple lines
duplicates, find
Solution
You can tokenize the words with `grep -wo` and find consecutive duplicates with `uniq -d`, add `-c` to count the number of duplicates, e.g.:
grep -wo '[[:alnum:]]\+' infile | sort | uniq -cd
Output:
2 abc
2 line
Problem
in Linux, I have a text file which have duplicate words like this ``` abc line 1 xyz zzz 123 456 abc end line ``` Now I want to print only all DUPLICATE words (which is abc) how ?