beautypg.com

Removing files (rm) – HP NonStop G-Series User Manual

Page 106

background image

The filename entry can be the name of the file, the relative pathname of the file, the absolute
pathname of the file, or a list of filenames separated by spaces. You can also use pattern-matching
characters to specify files.

A good example of what the sort command can do for you is to sort a list of names and put them
in collated order as defined by your current locale. For example, assume that you have lists of
names that are contained in three files: list1, list2, and list3.

list3

list2

list1

Hambro, Abe

Rocca, Carole

Zenith, Andrew

Anastio, William

Shepard, Louis

Dickson, Barry

Saluccio, Julius

Hillary, Mimi

D’Ambrose, Jeanette

Hsaio, Peter

Chung, Jean

Julio, Annette

To sort the names in all three files, enter:

$ sort list*

Anastio, William

Chung, Jean

D’Ambrose, Jeanette

Dickson, Barry

Hambro, Abe

Hillary, Mimi

Hsaio, Peter

Julio, Annette

Rocca, Carole

Saluccio, Julius

Shepard, Louis

Zenith, Andrew

You can also capture the sorted list by redirecting the screen output to a file named newlist by
entering the following:

$ sort list* >newlist

For more information on redirecting output, see

Chapter 11 (page 135)

. For a detailed description

of the sort command and its many options, see the sort(1) reference page either online or in
the Open System Services Shell and Utilities Reference Manual.

Removing Files (rm)

When you no longer need a file, you can remove it with the rm (remove file) command. You use
this command to remove a single file or multiple files.

Following is the general format of the rm command:

rm filename

The filename entry can be the name of the file, the relative pathname of the file, the absolute
pathname of the file, or a list of filenames. The format you use depends on where the file is located
in relation to your current directory.

106 Managing Files

This manual is related to the following products: