Text Processing


Manipulating text files can be a time-consuming process if done manually. The commands in Table A.5 are commonly used to manipulate the contents of text files. These commands normally work by outputting the data to standard out (otherwise known as the screen), so to capture these changes, you normally redirect the output to another text file using the greater-than sign (>). For example:

 sort /etc/passwd > /tmp/users.txt 

Table A.5. Commands Commonly Used to Process Text Files

COMMAND

GENERAL USAGE

DESCRIPTION

expand

expand FILE

Converts tab characters to spaces in the specified file.

joe

joe FILE

Text-editing utility.

nl

nl FILE

Assigns line numbers and displays the specified file.

pr

pr [OPTIONS] FILE

Formats a text file for printing.

sort

sort FILE

Alphabetically sorts and displays the specified file.

unexpand

unexpand FILE

Converts spaces to tab characters in the specified file.

uniq

uniq FILE

Displays all unique lines in the specified file.

vi

vi FILE

Text-editing utility. Use vimtutor for an introduction to this utility.

wc

wc [OPTIONS] FILE

Returns the number of lines, words, and characters in the specified file.




    NovellR Open Enterprise Server Administrator's Handbook SUSE LINUX Edition
    Novell Open Enterprise Server Administrators Handbook, SUSE LINUX Edition
    ISBN: 067232749X
    EAN: 2147483647
    Year: 2005
    Pages: 178

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net