Open In App

colrm command in Linux with examples

Improve
Improve
Like Article
Like
Save
Share
Report

colrm command in Linux is used for editing text in source code files, script files or regular text files. This command removes selected columns from a file. A column is defined as a single character in a line.

  • It always starts at index 1 and not 0.
  • If both start and end are specified, then the columns between them, including start and end will be removed.
  • If only one specific column needs to be deleted, then start and end must be the same.
  • colrm can also take input from stdin.

Syntax:

colrm [start] [stop]

Example 1: Here, we take input from stdin. Here the start and end are different. So all the characters between start and end, including start and end will be removed. Same can be used on a file (See example 2)

In the example given below, we take input form stdin. Here the start and end column are same i.e 6. So only the sixth character will be removed.

Example 2: Here, we first make a text file using cat command and then use colrm on the file.


Last Updated : 15 May, 2019
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads