home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: Reference: tput Chapter 2
UNIX Commands
Next: Reference: troff
 

tr



tr

 [

options

] [

string1

 [

string2

]]

Copy standard input to standard output, performing substitution of characters from string1 to string2 or deletion of characters in string1 .

Options

-c

Complement characters in string1 with ASCII 001-377.

-d

Delete characters in string1 from output.

-s

Squeeze out repeated output characters in string2 .

Examples

Change uppercase to lowercase in a file:



cat file | tr `[A-Z]` `[a-z]`

Turn spaces into newlines (ASCII code 012):



tr ' ' '\012' <file

Strip blank lines from file and save in new.file (or use \011 to change successive tabs into one tab):



cat file | tr -s "" "/012" > new.file

Delete colons from file ; save result in new.file :



tr -d : <file > new.file


Previous: Reference: tput UNIX in a Nutshell: System V Edition Next: Reference: troff
Reference: tput Book Index Reference: troff

The UNIX CD Bookshelf Navigation The UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System










??????????????@Mail.ru