Softprayog.in

Problem while using col

Error: usage: col [-bfhpx] [-l nline]

Solution:

Never believe what you hear and only half of what you see. (Anonymous)
Take nothing on its looks; take everything on evidence. There's no better rule. (Charles Dickens: Great Expectations)

The problem is that programmers are assuming the command to be

col [-bfhpx] [-l nline] [filename] # error in command usage

where as the command syntax is just

col [-bfhpx] [-l nline]


We are used to having a filename to be used as standard input as an optional parameter in commands. For example, in case of cat, grep, sed, awk, etc., the filename is an optional parameter. If a filename is given, it is treated as as standard input for the program. If it is not given, the program, simply reads its standard input, usually the keyboard. But this does not apply to col. col just reads its standard input.

So the solution lies in using the command as,

col [-bfhpx] [-l nline] [<filename]

As a footnote, let me mention that it often happens that one refers to a command so often that he or she wants to take a print of the manual output for the command using the man command. But when you redirect the man command to a file, it has a lot of the backspaces to get bold characters on printers. You can get rid of backspaces using the col command given above.





All text is available under the terms of GNU Free Documentation License