35.15 Cutting Columns with colrmBSD's (somewhat limited) alternative to cut (35.14 ) is colrm . It can cut only by column position, not by field.
All you have to
give it is a starting column position and an optional ending
position.
The text is read from standard input.
(colrm
can't read files directly; redirect input with
If you give just one column number, all columns from that position to the end of the line are removed. With two column number arguments, all columns between the starting column position and the ending position, inclusive, are removed. The following command outputs just the permissions (columns 1 to 10) and filenames (columns 45 to the end of the line, including the space before names) from fixed-width ls -l output (22.2 ) . (Some versions of ls -l adjust column widths. If yours does, colrm and cut won't help; try awk (33.11 ) .) % The following command will remove the remote hostname, if any, that starts at column 33 of who (51.4 ) output: % - , |
|