Professional Documents
Culture Documents
Linux Questions & Answers On Search & Pattern Matching - Sanfoundry
Linux Questions & Answers On Search & Pattern Matching - Sanfoundry
Answer: c
Explanation: None.
Answer: b
Explanation: None.
3. Assuming the files fileA, fileB, fileAB, fileBC and fileABC, exist in a directory, which files match with
the pattern file[ABC]?
a) fileA, fileB and fileABC
b) fileABC
c) fileA and fileB
d) fileAB, fileBC and fileABC
View Answer
https://www.sanfoundry.com/linux-questions-search-pattern-matching/ 1/8
1/31/24, 4:31 AM Linux Questions & Answers on Search & Pattern Matching - Sanfoundry
advertisement
Answer: b
Explanation: None.
5. Which one is used to select only one copy of the repeated lines?
a) uniq -u
b) uniq -d
c) uniq -c
d) uniq –I
View Answer
Answer: a
Explanation: None.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!
6. Indicate the right option to search for BOB, Bob, BOb or BoB?
a) grep –i Bob files
b) grep ‘B[oO][bB]’ files
https://www.sanfoundry.com/linux-questions-search-pattern-matching/ 2/8
1/31/24, 4:31 AM Linux Questions & Answers on Search & Pattern Matching - Sanfoundry
Answer: b
Explanation: None.
7. Indicate the right option to search for anything not a letter or number
a) grep ‘^[a-zA-Z0-9]’
b) grep ‘[^a-zA-Z0-9]’
c) grep ‘[a-zA-Z0-9]’
d) None of the mentioned
View Answer
Answer: b
Explanation: None.
advertisement
8. How do you remove duplicate lines from the file foo using uniq?
a) sort foo | uniq –u
b) sort -u foo | uniq -d
c) sort foo | uniq –c
d) sort foo | uniq –I
View Answer
Answer: a
Explanation: None.
https://www.sanfoundry.com/linux-questions-search-pattern-matching/ 3/8
1/31/24, 4:31 AM Linux Questions & Answers on Search & Pattern Matching - Sanfoundry
Answer: a
Explanation: None.
advertisement
Answer: a
Explanation: None.
11. What is the command that can print lines of first file matching with second file?
a) printline
b) cmp
https://www.sanfoundry.com/linux-questions-search-pattern-matching/ 4/8
1/31/24, 4:31 AM Linux Questions & Answers on Search & Pattern Matching - Sanfoundry
c) com
d) comm
View Answer
Answer: d
Explanation: None.
12. Which character to use to escape meaning of special characters in search operations?
a) []
b) ^
c) .
d) backslash (\)
View Answer
Answer: d
Explanation: We can use backslash character to escape the meaning of special characters in
search. For example: grep ‘\.’ a.txt OR grep ‘\*’ a.txt OR grep ‘\^’ a.txt will search for fullstop (.),
asterisk (*) or caret (^) characters respectively in the file a.txt
Sanfoundry Global Education & Learning Series – Linux Administration & Programming.
Here’s the list of Best Books in Linux Commands & Shell Programming.
Here’s the list of Best Books in Linux Kernel, Device-Drivers & System Programming.
To practice all questions on Linux Administration & Programming, here is complete set of 1000+
Multiple Choice Questions and Answers on Linux.
« Prev - Linux Questions & Answers – Shell » Next - Linux Shell Programming Questions and
Special Symbols Answers – Functions
Related Posts:
advertisement
https://www.sanfoundry.com/linux-questions-search-pattern-matching/ 5/8
1/31/24, 4:31 AM Linux Questions & Answers on Search & Pattern Matching - Sanfoundry
Recommended Articles:
1. Linux Questions & Answers – Linux Commands – 3
2. tailf Command in Linux
3. Linux Questions & Answers – File Types
4. Linux Questions & Answers – Linux Commands – 1
5. strings Command in Linux with Examples
6. less Command Examples and Tips for Effective Navigation in Linux
7. cut Command in Linux with Examples
8. Linux Filesystem Hierarchy Questions & Answers – 1
9. Linux Device Drivers Major-Minor Numbers Questions & Answers
10. Linux Questions & Answers – Linux Commands – 2
advertisement
https://www.sanfoundry.com/linux-questions-search-pattern-matching/ 6/8
1/31/24, 4:31 AM Linux Questions & Answers on Search & Pattern Matching - Sanfoundry
Additional Resources:
Linux MCQ Questions
Linux Commands with Examples
C Programs on File Handling
C# Programs on File Handling
Unix MCQ Questions
Popular Pages:
Java Applet Programs
String Programs in C++
C++ Algorithm Library
Event Handling in Java with Examples
Visual Basic MCQ Questions
Name
Subscribe
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at
Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies,
Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.
https://www.sanfoundry.com/linux-questions-search-pattern-matching/ 7/8
1/31/24, 4:31 AM Linux Questions & Answers on Search & Pattern Matching - Sanfoundry
https://www.sanfoundry.com/linux-questions-search-pattern-matching/ 8/8