Linux colrm Command
Complete Linux Command Reference
The Linux colrm command is used to filter out specified columns.
The colrm command reads data from the standard input device and outputs it to the standard output device. If no parameters are added, the command will not filter out any line.
Syntax
colrm [开始行数编号<结束行数编号>]
Parameter Description:
- Starting column number: Specifies the starting number of the column to be deleted.
- Ending column number: Specifies the ending number of the column to be deleted; this parameter can sometimes be omitted.
Examples
Without any parameters, the command will not delete any columns:
colrm
After pressing Enter, the cursor will blink on the first line, waiting for standard input. At this point, enter characters such as "Hello Linux!", then press Enter again and the second line will display the same content as the first line. At this point, you can press Ctrl+C to exit. The content displayed in the terminal is as follows:
cmd@hdd-desktop:~$ colrm Hello Linux! #输入Hello Linux!字符串 Hello Linux! #输出刚才输入的字符串Hello Linux!
If you want to delete all content after the 4th column, you can use the following command:
colrm 4
Similar to the previous example, at this point standard input waits for input. After the user enters a string and presses Enter, the following result will be output:
cmd@hdd-desktop:~$ colrm 4 Hello Linux! #输入Hello Linux!字符串 Hel #输出删除了第4列以后所有内容的字符串
Delete the content of specified columns. For example, to delete the content from the 4th column to the 6th column, you can use the following command:
colrm 4 6
The output result is as follows:
cmd@hdd-desktop:~$ colrm 4 6 Hello Linux! #输入Hello Linux!字符串 HelLinux! #输出删除了从第4列到第6列字符的字符串Other Extensions