Bird
0
0

In awk, what does the special variable NF represent?

easy📝 Conceptual Q1 of 15
Linux CLI - Text Processing
In awk, what does the special variable NF represent?
AThe number of lines in the input file
BThe value of the first field
CThe number of fields in the current record
DThe total number of characters in the line
Step-by-Step Solution
Solution:
  1. Step 1: Understand NF in awk

    NF is a built-in variable that holds the number of fields in the current input line.
  2. Step 2: Compare options with definition

    Only The number of fields in the current record correctly describes NF as the number of fields in the current record.
  3. Final Answer:

    The number of fields in the current record -> Option C
  4. Quick Check:

    NF = number of fields [OK]
Quick Trick: Remember NF counts fields per line, not lines or characters [OK]
Common Mistakes:
  • Confusing NF with NR (number of records)
  • Thinking NF counts characters
  • Assuming NF is a field value

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes