linux terminal sort command sorting

Go directly to the demo:

Insert image description here

sort part

sort frames-7/frames/tmp_logs.log -t ' ' -k 7 -n -k 11 -n -o frames-7/frames/tmp_logs.log
  • sort [file] Sort a file
  • -t [delimiter] separate each line of the file by [delimiter]
  • -k [column] After separating each line of the file, sort according to the column
  • -n sorting rules are sorted by number, otherwise the default is string sorting
  • -o redirect output, rewrite the sorted file to a file
This demo-sort part is explained as follows: split each line of the frames-7/frames/tmp_logs.log file according to spaces, and sort it first according to the number in the 7th column after splitting, and then sort it again according to the number in the 11th column. Sorting, sorting is incremented by default, and the final redirection result will overwrite the source file

Guess you like

Origin blog.csdn.net/only_a_Heroic_car/article/details/130828354