awk question

I would like to print every field from the 11th field to the $NF field.  Is there a way to do this?

For example, if there were 14 fields total I would want to print 11th, 12th, 13th, and 14th fields in my awk statement.  But I won't know ahead of time there are 14 total fields, so is there a way to do it using the $NF variable?
LVL 3
bryanlloydharrisAsked:
Who is Participating?
 
ozoConnect With a Mentor Commented:
awk '{ORS=OFS;for( i=11;i<=NF; i++ ){ print $i }print "\n"}'
0
 
bryanlloydharrisAuthor Commented:
Can you tell me what ORS and what OFS stand for?  (I assume OFS means Output File Seperator?)
0
 
ozoCommented:
      OFS    output field separator (default blank)

       ORS    output record separator (default newline)
0
 
bryanlloydharrisAuthor Commented:
Thanks for all your help!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.