Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • Great solution! If it happens to be variable number of lines, you can make it more general with awk -v RS= -v OFS=, '{for (i=3; i<=NF; i+=3) printf "%s%s", $i, (i==NF?"\n":OFS)}' file - that is, to print every 3 fields. Commented Aug 1, 2014 at 9:45
  • 2
    I love how the line awk -v RS= -v OFS=, '{print $3,$6,$9,$12,$15,$18}' is prefixed with the adverb "simply". Commented Aug 1, 2014 at 14:21