Sunday, 28 February 2021

LINUX - HOW TO SORT DATA IN A FILE AND STORE IT INTO ANOTHER FILE

  LINUX - HOW TO SORT DATA IN A FILE AND STORE IT INTO ANOTHER FILE

 
The command is as given below:-
 

Command :- sort <sorttest.txt>sorted1.txt

 In the below example, I created a file sorttest.txt and entered data in it.


Now I will enter data into the file sorttest.txt and save  the file by pressing ESC key and :wq

We can see  the file contents by typing the command cat sorttest.txt

Now we will use the sort command to sort the data and redirect the output to a different file sorted1.txt

 We usd the standard input < to feed the data into sort and redirected it by using > to a file named sorted1.txt.

sort <sorttest.txt>sorted1.txt



No comments:

Post a Comment