0

Background

In the awk command, you can print a whole column of output like so:

cat doc.txt | awk '{print $4}'

The above code snippet would stream the text file doc.txt and pipe that to awk, which would then output everything in the fourth column of the stream.

You can also select a specific row in awk like in the example from this answer:

awk 'FNR == 2 {print}'

However, I don't just want one specific row. I want everything starting from a specific row onward within a specific column. In other words, I want something like this:

cat doc.txt | awk '<command that gets every row from row 2 onward> {print $4}'

Question

Is it possible to start from a certain row of output with the awk command?

Inian
  • 80,270
  • 14
  • 142
  • 161
isakbob
  • 1,439
  • 2
  • 17
  • 39
  • 1
    Use: `awk 'NR>=2{print $4}'` – anubhava May 21 '20 at 14:02
  • 1
    See also [printing-with-sed-or-awk-a-line-following-a-matching-pattern](https://stackoverflow.com/questions/17908555/printing-with-sed-or-awk-a-line-following-a-matching-pattern/17914105#17914105) – Ed Morton May 21 '20 at 14:10

0 Answers0