Get the App
SLTechnology News&Howtos  ›  Network Security  › 

Sort command

Shulou Source: shulou.com Published: 2022-06-01 03:04:47 10月04日 Update

The sort command is used to sort files

Sort multiple files at the same time

# sort a.txt b.txt

Sort by number

# sort-n a.txt

Sort in reverse order

# sort-r aa.txt bb.txt

Specify the column to sort (for example: specify the second column to sort)

# sort-k 2 aa.txt bb.txt

Specify the delimiter (for example: with a colon as the delimiter)-- >-t,-- field-separator

# sort-t:-K3-n / etc/passwd

Remove duplicate lines after sorting

# sort-u-n aaa.txt

Tags: Sort delimiter file command colon simultaneous multiple numeric reverse Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology MariaDB Apple Huawei OPPO Reno