AIX命令之 文件比较和文件内容排序

比较文件
diff 1.txt 2.txt

忽略空格
diff -w 1.txt 2.txt


对文件进行排序
cat people.txt | sort

按照第三列和第1列进行排序
$ cat people.txt | sort -k3,3 -k1,1
Emily Bedford 18
James Bedford 21
Fred Bloggs 22
Pete Brown 37
Ana Villamor 44
Mark Brown 46
Alice Villamor 50
Tony Bedford 50
John Strange 51
Stefan Heinz 52
Francis Chepstow 56
Simon Strange 62

按照第三列和第2列进行排序
$ cat people.txt | sort -k3,3 -k2,2
Emily Bedford 18
James Bedford 21
Fred Bloggs 22
Pete Brown 37
Ana Villamor 44
Mark Brown 46
Tony Bedford 50
Alice Villamor 50
John Strange 51
Stefan Heinz 52
Francis Chepstow 56
Simon Strange 62

请使用浏览器的分享功能分享到微信等