How to use cut command in bash to show all columns except those indicated?

Hermandroid picture Hermandroid · Mar 12, 2013 · Viewed 48.8k times · Source

I need to remove a column from a plain text file. I think this could be done using the inverse of the cut command. I mean, something like this:

If this is my file:

01 Procedimiento_tal retiro aceptado
01 tx1
01 tx2
01 tx3
02 Procedimiento_tal retiro rechazado
02 tx1
02 tx2
02 tx3
03 Procedimiento_tal retiro aceptado
03 tx1
03 tx2
03 tx3

What can I do to remove the first column with cut and get the following text in bash?:

Procedimiento_tal retiro aceptado
tx1
tx2
tx3
Procedimiento_tal retiro rechazado
tx1
tx2
tx3
Procedimiento_tal retiro aceptado
tx1
tx2
tx3

Thanks in advance

Answer

William Pursell picture William Pursell · Mar 12, 2013

Using cut:

cut -d ' ' -f 2- input-file

should do what you want.