Linux Command sort
The sort command sorts all rows in the file. The sort command has many very useful options, which were initially used to sort the file content in the database format. In fact, the sort command can be considered as a very powerful data management tool to manage files with similar content to database records. The Sort command sorts the content in the file line by line. If the first character of the two lines is the same, the command will continue to compare the next character of the two lines, the comparison will continue. Syntax: sort [Option] File Description: The sort command sorts all rows in the specified file and displays the results on the standard output. If the input file is not specified or "-" is used, the sorting content comes from the standard input. Sort sorting is done by comparing one or more keywords extracted from the input line. The sorting keyword defines the smallest character sequence used for sorting. By default, the entire behavior keyword is ordered by ASCII characters. The main options for changing the default settings are-m. If the given file is sorted, merge the file. -C check whether the given files are sorted in order. If they are not all sorted, an error message is printed and the system exits with the status value 1. -U considers that only one row is left for the same row after sorting. -O: the output file writes the sorting output to the output file instead of the standard output file. If the output file is one of the input files, sort first writes the content of the file to a temporary file, then sort and write the output results. The main options for changing the default sorting rules are:-d sort the Rules alphabetically. Only letters, numbers, spaces, and tabs are meaningful during comparison. -F treats lowercase letters as uppercase letters. -I ignore non-printable characters. -M is used as the month comparison: "JAN" <"FEB"-r returns the sorting result in reverse order. + Posl-pos2 specifies one or more fields as the sorting keyword. The field position starts from posl to pos2 (including posl, excluding pos2 ). If pos2 is not specified, the keyword is from posl to the end of the row. The position of the field and character starts from 0. -B ignores leading spaces (spaces and tabs) when searching for sorting keywords in each line ). -T separator specifies the character separator as the field separator.