Unix Power ToolsUnix Power ToolsSearch this book

43.2. One Argument with a cat Isn't Enough

What's wrong with this command line?

cat Section 12.2

% 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.

The command line above 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 (Section 43.1):

% tr -d '\015' < filename > newfile

--JP and TC



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.