I'm trying to do this but I cant create the file.
sort myfile.txt uniq -u | tee newfile.txt
and It wont create the file automatically. What am I missing here?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
You are missing one pipe
sort myfile |uniq -u|tee newfile.txt
If this is not working, please provide the error message you are getting.
By the way, this command
uniq -u eliminates all lines which have duplicates. If this is your intention, that is fine. But if you want to see one of the duplicate lines, you need to drop
-u for the
uniq part of this command line, i.e.,
sort myfile | uniq | tee newfile.txt