Sorry guys I had to edit my example, because I didn't express my query properly. Let's say I have the .txt file:
Happy sad
Happy sad
Happy sad
Sad happy
Happy sad
Happy sad
Mad sad
Mad happy
Mad happy
And I want to delete any string that is unique. Leaving the file with:
Happy sad
Happy sad
Happy sad
Happy sad
Happy sad
Mad happy
Mad happy
I understand that sort is able to get rid of duplicates (sort file.txt | uniq), so is there anyway we can do the opposite in bash using a command? Or would I just need to figure out a while loop for it?
BTW uniq -D file.txt > output.txt doesn't work.