Home > Unix Programming > Quizzes > Unix Basics Practice Test: Unix Filters - grep and sed
Unix Basics Practice Test: Unix Filters - grep and sed
Fast practice, instant feedback. Timer auto-submits when time’s up.
Avg score: 73% Most missed: “Which of the following command is used with sed for outputting as well as printi…”
Unix Basics Practice Test: Unix Filters - grep and sed
Time left 00:00
25 Questions

1. Consider the following commands.
$ sed -n ‘1,2p’ emp.lst
$ sed -n ‘3,$!p’ emp.lst
The output of both commands will be the same.
2. When the pattern is not found in a file, grep command silently returns the prompt.
3. To suppress the behavior of ‘p’ command of sed, we use ____ option.
4. To perform context addressing, we have to enclose the pattern in ____
5. ____ option is used for taking instructions from a file.
6. Which of the following characters are used with sed as anchoring characters?
7. Which option is used when we want to use an ERE with grep command?
8. Which of the following symbol is used for matching the immediately preceding character?
9. Character class is used for matching a group of characters enclosed within a pair of _____
10. Which symbol is used for matching a single character?
11. Which of the following symbols are used for matching a pattern at specified locations?
12. Which one of the following command will be used for quitting after selecting 3 lines from file emp.lst?
13. The interval regular expression uses the character _______
14. For taking patterns from a file, -f option is specified with grep command.
15. The following command will match ‘Agarwal’, ‘agarwal’ and ‘agrawal’.
$ grep “[aA]g[ar][ar]wal” emp.lst
16. To select lines containing gupta and agarwal, which command will be used?
17. To replace the string ‘director’ in the first five lines of file emp.lst with ‘manager’ we can use _____
18. If there are special characters in a pattern, then we’ve to enclose them in ______
19. _____ option is used when we need to match multiple patterns in a single invocation of grep command?
20. Which one of the following command is used for replacing | with : globally?
21. Which of the following is not a subset of BRE (basic regular expression) character subset?
22. Which shortcut does sed offer to replace the string Linux with Red hat Linux?
23. sed can also perform the substitution.
24. Which command will be used for selecting lines 3 to 10 from emp.lst?
25. Which one of the following is the correct syntax for performing substitution using sed?