user2090227
user2090227

Reputation: 83

How to create output file using command line?

I'm using this command to remove all duplicate lines:

sort file.txt | uniq -u

But it just displays all the unique lines in terminal. What do I need to change to make it create a new file named newfile.txt that all the unique lines are in?

Upvotes: 1

Views: 491

Answers (1)

Pradheep
Pradheep

Reputation: 3819

just redirect to a file

sort file.txt | uniq -u > newfile.txt

Upvotes: 3

Related Questions