Which built-in variable is used by the awk to specify the line numbers?

KellyPoima

New member
Which built-in variable is used by the awk to specify the line numbers?
A. AR
B. NR
C. $$
D. $?
 
Answer: b
Explanation: awk uses the built-in variable NR to specify line numbers. For example, to select lines 3 to 6 use the following command:
Code:
$ awk  -F “|” ‘NR == 3, NR == 6 { print NR, $2, $4 }’ emp.lst
 

Tìm kiếm

Back
Top