Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

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 tab-demlimted file, I want to sort them only for red_ball as follows


id      tagid    name
HH556   EN76     red_ball
JH678   EN45     green_ball
MH678   CV67     red_ball
TY896   RT56     red_ball



id  tagid
HH556   EN76
MH678   CV67
TY896   RT56
share|improve this question
up vote 1 down vote accepted
  printf 'Red_ball\nid\ttagid\n\n'
  awk -F'\t'  'NR>1 && $3 == "red_ball" {print $1 "\t" $2}' < input.txt |
} > output.txt
share|improve this answer

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.