Sorting file contents (sort) – HP NonStop G-Series User Manual
Page 105

The actual differing lines then follow. In the leftmost column, < (left angle bracket) indicates lines
from file1 and > (right angle bracket) indicates lines from file2.
For example, suppose that you want to quickly compare the following meeting rosters in the files
jan15mtg
and jan22mtg:
jan22mtg
jan15mtg
alice
alice
brent
colleen
carole
daniel
colleen
david
daniel
emily
david
frank
emily
grace
frank
helmut
grace
howard
helmut
jack
jack
jane
jane
juan
juan
lawrence
lawrence
rusty
rusty
soshanna
soshanna
sue
sue
tom
tom
You can use the diff command to compare jan15mtg with jan22mtg as follows:
$ diff jan15mtg jan22mtg
1a2,3
> brent
> carole
9d10
< howard
Here we find that Brent and Carole attended the meeting on January 22, and Howard did not.
We know this because the line number and text output indicate that brent and carole are
additions to file jan22mtg and that howard is a deletion.
In cases where there are no differences between files, the system returns your prompt. For more
information, see the diff(1) reference page either online or in the Open System Services Shell
and Utilities Reference Manual.
Sorting File Contents (sort)
You can sort the contents of text files with the sort command. You can use this command to sort
a single file or multiple files.
Following is the general format of the sort command:
sort filename
Sorting File Contents (sort) 105