Organizing Lists with the sort Command

GETTING SORTED

Article from Issue 52/2005
Author(s):

sort helps you organize file lists and program

output. And if you like, you can even use this small

but powerful tool to merge and sort multiple files.

The sort command allows you to

sort a file line by line. The command

can either process a specified

file or read from standard input. You

decide the sort criteria – sort has parameters

that give you granular control.

Simple Sorting Exercises

/etc/passwd is an excellent place to start

experimenting with sort. If you look

inside the file, you will see that the lines

comprise a number of fields, for example:

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News