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


UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 13.1 Using Standard Input and Output Chapter 13
Redirecting Input and Output
Next: 13.3 Send (only) Standard Error Down a Pipe
 

13.2 One Argument with a cat Isn't Enough

What's wrong with this command line?



cat
 

% 

cat filename | tr -d '\015' > newfile

As Tom Christiansen wrote in a Usenet article:

A wise man once said: if you find yourself calling cat with just one argument, then you're probably doing something you shouldn't.

That command line only uses cat to feed the file to the standard input of tr . It's a lot more efficient to have the shell do the redirection for you with its < character ( 13.1 ) :

% 

tr -d '\015' < filename > newfile

- JP , TC


Previous: 13.1 Using Standard Input and Output UNIX Power Tools Next: 13.3 Send (only) Standard Error Down a Pipe
13.1 Using Standard Input and Output Book Index 13.3 Send (only) Standard Error Down a Pipe

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