Questions
Questions
Single choice

Shell command (1 mark)How many lines will be output by the following shell command? cat data.csv | awk -F’,’ ’rand()<9/10 {print $9}’[Fill in the blank]

Options
A.A. approximately 9% of the lines in the original file
B.B. approximately 90% of the lines in the original file
C.C. impossible to tell
D.D. exactly 10
Question Image
View Explanation

View Explanation

Verified Answer
Please login to view
Step-by-Step Analysis
The question asks how many lines will be output by the pipeline: cat data.csv | awk -F’,’ ’rand()<9/10 {print $9}’. First, consider what the awk command is doing: -F’,’ sets the input field separator to a comma, so $9 refers to the 9th field in each line. The condition rand()<9/10 is a per-line test that uses the built-in rand() function, which generates a random......Login to view full explanation

Log in for full answers

We've collected over 50,000 authentic exam questions and detailed explanations from around the globe. Log in now and get instant access to the answers!

More Practical Tools for Students Powered by AI Study Helper

Join us and instantly unlock extensive past papers & exclusive solutions to get a head start on your studies!