Search code examples
linuxbashcut

Cut order all fields except one


I'm having problems with the order cut, i'm trying to show all the fields from a document except the second one without knowing the total number of fields how. I already tried this:

cut -f -2- example

I don't seem to find the correct option for doing it. Any ideas?


Solution

  • You can use:

    cut -f1,3- file
    

    This will print field 1 and all fields from 3 onwards.

    Note that default delimiter for cut is a tab character.