Search

colrm to remove columns from a text file

Organizing data is columns is a very common occurrence and need for manipulation these columns is needed often. colrm is a command that helps us remove a set of columns easily from a text file.

colrm takes two optional arguments


start: The first column that has to be removed stop: The last column that has to be removed.
The command treats every character in a row as a column. If we specify only the start column, the characters starting from 'start' column number till the end.
For example if we have the following file
data:



The file has data in three columns. One set of numbers, one set of blank characters and one set of alphabets. To remove the alphabets, which is the third and last column we need to specify only the column number from which to begin as the alphabets are the last column.



If we want to remove the column from between, like the column of numbers which is the first column we can pass the starting and ending column numbers as shown below.



We can see that only the first and second columns are removed and the other columns are displayed.

No comments:

Post a Comment