What does the -t option in the sort command specify?

The -t option in the sort command specifies a delimiter that separates fields in the input data. By default, sort uses whitespace as the delimiter, but with the -t option, you can define a different character to be used as the field separator.

For example, if you have a CSV file and you want to sort it based on the second column, you can use:

sort -t, -k2 file.csv

In this command, -t, sets the comma as the delimiter, and -k2 specifies that the sorting should be done based on the second field.

0 Comments

no data
Be the first to share your comment!