- PART 2: Executing the grep Command (continued) In this part of the lab, you wi
ID: 3636929 • Letter: #
Question
- PART 2: Executing the grep Command (continued)In this part of the lab, you will formulate a command using grep to filter information from a file named "Texas.txt" located in the Element K Unix environment. You will print the line number containing the specified pattern below. Use the file (Wk2 Lab part2 texas file.docx) provided in Doc Sharing as a template for what you should submit for this section of the lab. The list below provides you with specific patterns to search or filter. Your job is to document the result of each of the commands you execute in the system.
Pattern to search:
Find all lines that contain the word cow.
Find all lines that contain x, y, or z.
Find all lines that have the pattern "ull" some place.
Find all lines that start with "if".
Find all lines that end with "in".
Find all lines that have an apostrophe (').
(Texas file.docx below)
(task) (grep command) (Which line numbers?)
1. Find all lines that contain "cow ".
2. Find all lines that contain "x", "y", or "z".
3. Find all lines that have the pattern "ull" someplace.
4. Find all lines that start with "If".
5. Find all lines that end with "in.".
6. Find all lines that have an apostrophe, " ' ".
Explanation / Answer
1. grep -w "cow" file.docx (-w ensures entire word match - so for example, cower won't match here but cow will) 2. grep "[xyz]" file.docx 3. grep "ull" file.docx 4. grep "^cow" file.docx 5. grep "in.$" file.docx 6. grep ' file.docx
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.