UGC NET CS 2019System Software and Operating System › Linux Operating SystemsVerified
UGC NET CS 2019 PYQ: Which of the following UNIX/Linux pipes will count the number of lines in all the files having .c and .h as…
Which of the following UNIX/Linux pipes will count the number of lines in all the files having .c and .h as their extension in the current working directory?
- Acat $* \cdot$ ch $\: \mid$ wc $-1$
- Bcat $* \cdot [$ c-h $] \: \mid$ wc $-1$
- Ccat $* \cdot [$ ch $] \: \mid$ ls $-1$
- Dcat $* \cdot [$ ch $] \: \mid$ wc $-1$Correct answer
Answer
(D) cat $* \cdot [$ ch $] \: \mid$ wc $-1$
Approach
Use shell globbing and
wc -l to count lines.Reviewed by UGC IQ Editorial Team.