colrm
Remove columns from a file or input
TLDR
Remove first column of stdin
Remove from 3rd column till the end of each line
Remove from the 3rd column till the 5th column of each line
SYNOPSIS
colrm [start_column] [end_column]
PARAMETERS
start_column
A 1-based integer specifying the first character position to remove.
end_column
A 1-based integer specifying the last character position to remove (inclusive). If omitted, removes to end of line.
DESCRIPTION
colrm is a command-line utility that reads lines from standard input, removes characters within specified column ranges, and writes the modified lines to standard output. Unlike tools that operate on delimited fields, colrm works directly on 1-based character positions. It accepts one or two 1-based integer arguments.
If only a start_column is provided, all characters from that position to the end of the line are removed. If both start_column and end_column are given, characters within that inclusive range are removed. This command is particularly useful for extracting or tidying up fixed-width textual data by position.
CAVEATS
Caveats and limitations:
colrm operates strictly on 1-based character positions (columns), not on semantic fields or delimiters. This can lead to unexpected results with variable-width data where you intend to remove logical "fields".
It processes standard input and writes to standard output, necessitating redirection or piping for file operations.
The command lacks options for delimiter specification, multi-byte character handling, or error suppression, making it a highly specialized and less flexible tool compared to cut or awk for diverse text processing.
HISTORY
colrm is a standard Unix utility, part of the GNU Coreutils package on Linux systems. Its design reflects a simple, stream-based text processing paradigm, and its core functionality has remained consistent over time, serving as a specialized tool for fixed-width column manipulation.