[[email protected] test]$ cat sort_h60mb
1000kb
20mb300kb
a40gb50kb
1.Direct sorting.
[[email protected] test]$ cat sort_h | sort
1000kb
20mb300kb40gb
50kb60mb
a
2.Sort from a human perspective -h
Characters take precedence over numbers, and units such as kilobytes, megabytes, and gigabytes are automatically sorted in size.
[[email protected] test]$ cat sort_h | sort -ha
50kb300kb
1000kb
20mb60mb
40gb
3.Sort -r in reverse order
[[email protected] test]$ cat sort_h | sort -hr
40gb60mb
20mb1000kb
300kb50kb
a
Material: 2 (digital only).
[[email protected] test]$ cat sort_n | sort
1.Sort by actual numeric size -n
[[email protected] test]$ cat sort_n | sort -n
2.Save the sorting result to the specified file -o
cat sort_n | sort -nr -o 1.txtFootage (character delimited).
[[email protected] test]$ cat sort_t
1sp2sp3sp4
2sp1sp2sp3
3sp3sp4sp2
8sp7sp6sp4
6sp4sp9sp7
1.Specify the separator -t, and then sort -k based on the contents of column n-k
[[email protected] test]$ cat sort_t | sort -t . k 2
1sp2sp3sp4
2sp1sp2sp3
3sp3sp4sp2
6sp4sp9sp7
8sp7sp6sp4
[[email protected] test]$ cat sort_t | sort -t p -k 4
3sp3sp4sp2
2sp1sp2sp3
1sp2sp3sp4
8sp7sp6sp4
6sp4sp9sp7
[[email protected] test]$ cat sort_v
docker v10.2.3
docker v1.4.7
docker v5.2.8
docker o.x.5.1
Sort by version -v
[[email protected] test]$ cat sort_v | sort -v
docker v1.4.7
docker v5.2.8
docker v10.2.3
docker o.x.5.1
The Hogwarts Test Management Class is a course for test and quality managers, which enables test managers to better lead teams, projects, and companies to grow faster by improving their skills in team management, project management, performance management, and communication management. Provide 1v1 personal training guidance, and BAT-level test management experts tailor career planning.