Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a really large text file (~80 Million records/lines), where each record has 7 attributes. Between every attribute there is a tab.

What I want to do is copy every third and last attribute/token of every record/line at a new file.

Any ideas how I could do that with the cut command?

share|improve this question
up vote 6 down vote accepted

A good starting point would be:

cut -f 3,7 input.txt > output.txt

If the file isn't tab delimited, you'll need to add a -d switch with the delimiter ( -d. would be a . delimited file).

Here are some examples, including grabbing multiple fields:

share|improve this answer
You beat me to it. – Ansgar Wiechers Oct 13 '12 at 23:39
Is there any way I could cut specific rows based on the numerical value of some attributes? For example cut every row's 3 and 7 column but only if the fifth attribute < 5. – ddmichael Oct 31 '12 at 22:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.