2013-01-31

tr: extra operand

Kept getting this error when trying to delete Ctrl+Z (octal 032) from a file:

tr -d \032 file.txt
tr: extra operand `file.txt'
Only one string may be given when deleting without squeezing repeats.
Try `tr --help' for more information.

I keep forgetting that tr is expecting data from a stream not a file so the solution is to redirect the input: tr -d \032 < file.txt.