Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Linux colrm Command

Linux colrm Command

Linux Command Reference Linux Command Reference

The Linux colrm command is used to filter out specified lines.

The colrm command reads data from standard input and outputs it to standard output. If no options are given, the command does not filter out any line.

Syntax

colrm [开始行数编号<结束行数编号>]

Parameter Description:

Example

Without any options, the command does not delete any columns:



colrm

After pressing Enter, the cursor will blink on the first line, waiting for standard input. Enter characters, such as "Hello Linux!", then press Enter again and the second line will show the same content as the first. Press the Ctrl+C key combination to exit. The content displayed in the terminal is as follows:



cmd@hdd-desktop:~$ colrm  

Hello Linux! #输入Hello Linux!字符串  

Hello Linux! #输出刚才输入的字符串Hello Linux! 

To delete everything after column 4, use the following command:



colrm 4

Similar to the previous example, standard input is now waiting for input. After the user enters a string and presses Enter, the following result is output:



cmd@hdd-desktop:~$ colrm 4  

Hello Linux! #输入Hello Linux!字符串  

Hel #输出删除了第4列以后所有内容的字符串 

To delete the content of specified columns, for example to delete the content from column 4 to column 6, 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列字符的字符串 

Linux Command Reference Linux Command Reference