Entries tagged with awk rss

selective field printing with awk

You have a tab-delimited file and only want certain fields.

awk 'BEGIN{OFS=FS="\t"}{print $3,$4 }' ipa_uni_test.txt

Important things:

  • FS is the "field separator", so it could be "," or similar instead of "\t"
  • OFS is the "output field separator". This replaces the ',' in the print statement.
  • $3 is a positional variable; it's the 3rd field.