Question: Project 3 - 7 ESTIMATED TIME: 3 0 minutes OBJECTIVE: Use regular expressions. DESCRIPTION: In this hands - on project, you use the grep and

Project 3-7
ESTIMATED TIME: 30 minutes
OBJECTIVE: Use regular expressions.
DESCRIPTION: In this hands-on project, you use the grep and egrep commands alongside regular expression metacharacters to explore the contents of text files.
1
Switch to a command-line terminal (tty5) by pressing Ctrl+Alt+F5 and log in to the terminal using the user name of root and the password of LINUXrocks!.
2
At the command prompt, type grep "Inn" sample1 and press Enter. What is displayed?
3
At the command prompt, type grep -v "Inn" sample1 and press Enter. What is displayed?
4
At the command prompt, type grep "inn" sample1 and press Enter. What is displayed and why?
5
At the command prompt, type grep -i "inn" sample1 and press Enter. What is displayed?
6
At the command prompt, type grep "I" sample1 and press Enter. What is displayed?
7
At the command prompt, type grep " I " sample1 and press Enter. What is displayed?
8
At the command prompt, type grep "t.e" sample1 and press Enter. What is displayed?
9
At the command prompt, type grep "w...e" sample1 and press Enter. What is displayed?
10
At the command prompt, type grep "^I" sample1 and press Enter. What is displayed?
11
At the command prompt, type grep "^I " sample1 and press Enter. What is displayed?
12
At the command prompt, type grep "(we|next)" sample1 and press Enter. What is displayed? Why?
13
At the command prompt, type egrep "(we|next)" sample1 and press Enter. What is displayed?
14
At the command prompt, type grep "Inn$" sample1 and press Enter. What is displayed?
15
At the command prompt, type grep "?$" sample1 and press Enter. What is displayed and why? Does the ? metacharacter have special meaning here? Why?
16
At the command prompt, type grep "^$" sample1 and press Enter. Is anything displayed? (Hint: Be certain to look closely!) Can you explain the output?
17
Type exit and press Enter to log out of your shell.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!