AWK utility
Consider the following awk program: { $1="A" ; print $0 }
What is the output if the input consists of the following
line:
program program
Question 1 options:
program
program program
A program
The awk program fails
None of the above
Question 2
The awk command can use an inline script specified on the command
line or a file based script specified by the -f option
Question 2 options:
True
False
Question 3
Match each awk built-in variable with its description.
Question 3 options:
RS
NR
FILENAME
NF
FS
1.
The input field separator, a space by default.
2.
The total number of input records seen so far.
3.
The input record separator, by default a newline.
4.
The number of fields in the current input record.
5.
The name of the current input file.
6.
Not an awk built-in variable.
7.
The next field in the current input record.
Question 1:
Consider the following awk program: { $1="A" ; print $0 }
What is the output if the input consists of the following
line:
program program
Answer:
program
program program (Correct Answer)
A program
The awk program fails
None of the above
Question 2
The awk command can use an inline script specified on the command
line or a file-based script specified by the -f option
Answer:
True (Correct Answer)
False
Question 3
Match each awk built-in variable with its description.
Answer:
RS -- The input record separator, by
default a newline.
NR -- The total number of input
records seen so far.
FILENAME -- The name of the current input
file.
NF -- The number of fields in the
current input record.
FS -- The input field
separator, a space by default.
Get Answers For Free
Most questions answered within 1 hours.