Removing columns of characters from a line
In a file with a similar content shown below, one can remove certain
columns based on the delimiters.
If, for example, one wants to remove the part sometext# in each line,
use the following command
filename is the name of the file that contains the text (duh!!)
If the delimiter is space, such as the following
use the following command:
columns based on the delimiters.
aaa:123:sometext1:name1:zz
bbbbbbb:44457:sometext2:name2:yy2
ccccc:783456:sometext3:name3:xx3
If, for example, one wants to remove the part sometext# in each line,
use the following command
cut -d: -f1,2,4,5 filename
: is the delimiting character.
filename is the name of the file that contains the text (duh!!)
If the delimiter is space, such as the following
bb1 457 sometext2 name2 yy2
use the following command:
cut -d' ' -f1,2,4,5 filename
Comments