Sort a file :
|
sort filename.dat > newfilename.dat If you have numbers instead of characters in the file, then : sort -n filename.dat > newfilename.dat sort -n -r filename.dat > newfilename.dat This will sort the file in reverse order If your file has multiple fields and you want to sort based on the second field then: sort -n +1 filename.dat > newfilename.dat |
Find Union,Intersection or Difference of Files
|
Union of two files : sort file1 file2 | uniq > union_file Intersection of two files : sort file1 file2 | uniq -d > intersection_file Difference of two files : sort file1 file2 | uniq -u > difference_file |