Project 3-5 should give you sample1 please only answer question for project 3-7
ID: 3878920 • Letter: P
Question
Project 3-5 should give you sample1 please only answer question for project 3-7 only.
Project 3-5 In this hands-on project, you create and edit text files using the vi editor. 1. Switch to a command-line terminal (tty2) by pressing Ctrl+Alt+F2 and log in to the ter- minal using the user name of root and the password of LNXrocks! 2. At the command prompt, type pwd, press Enter, and ensure that /root is displayed, showing that you are in the root user's home folder. At the command prompt, type vi samplel and press Enter to open the vi editor and create a new text file called sam- ple1. Notice that this name appears at the bottom of the screen along with the indica- tion that it is a new file. 3. At the command prompt, type My letter and press Enter. Why was nothing displayed on the screen? To switch from command mode to insert mode to allow the typing of text, press i. Notice that the word Insert appears at the bottom of the screen. Next, type My letter and notice that this text is displayed on the screen. What types of tasks can be accomplished in insert mode? 4. Press Esc. Did the cursor move? What mode are you in now? Press two times until the cursor is under the last t in letter. Press the x key. What happened? Next, type i to enter insert mode, then type the letter "h." Did the letter "h" get inserted before or after the cursor? 5. Press Esc to switch back to command mode and then move your cursor to the end of the line. Next, type the letter "o" to open a line underneath the current line and enter insert mode. 6. Type the following It might look like I am doing nothing, but at the cellular level I can assure you that I am quite busy. And to a typical cell, it may seem like they are doing all the work! Notice that the line wraps to the next line partway through the sentence. Though displaye over two lines on the screen, this sentence is treated as one continuous line of text in vi Press Esc to return to command mode, and then press-Where does the cursor move? Use the cursor keys to navigate to the letter ” at the beginning of the word "level," and then press the i key to enter insert mode. Press the Enter key while in insert mode. Next press Esc to return to command mode, and then press " Where does the cursor move? 7. Type dd three times to delete all lines in the file. 8. Type i to enter insert mode, and then type: Hi there, I hope this day finds you well. and press Enter. Press Enter again. Type Unfortunately we were not able to make it to your diningExplanation / Answer
2.grep "Inn" sample1
This is a basic grep command to search for specific string in a file.
It displayed nothing because the word "Inn" not found in Sample1 file.
3.grep -v "Inn" sample1
-v -> displays the lines which doesnt match the given word "Inn".So it displayed complete file data because it doesnt match the "Inn"
4.grep "inn" sample1
it displayed "Unfortunately we were not ale to make it to your dinning"
Becuase the grep command search for string "inn" in sample1 file and it found it in the above line.
5.grep -i "inn" sample1
it displayed "Unfortunately we were not ale to make it to your dinning",
in step2: grep search for specific string "Inn"(caps I) and it diaplyed nothing because matching word doesnt found
in step4: grep search for specific string "inn"(small i)
but here -i means ignore case hence it search for string "inn" doesnt care whether its uppercase or smallercase
6.grep "I" sample1
it displayed "Hi there,I hope this day finds you well." because it searched for letter "I"
7.grep " I " sample1
it diaplayed nothing becuase it searched for " I " and couldnt found in the sample1 file. in step6 it only searched for letter "I" and matches found
8.grep "t.e" sample1
it displayed "Hi there,I hope this day finds you well".
"t.e" is a regular expression and . means any character.Grep command search for string starts with "t" and ends with "e" and any charcter in between
9.grep "w...e" sample1
it displayed "Unfortunately we were not ale to make it to your dinning"
"w...e"" is a regular expression and . means any character.Grep command search for string starts with "w" and ends with "e" and any 3 charcter in between(it contains 3 dots)
10.grep " ^I" sample1
displayed nothing.^ denotes the beginning of the line.and file does not contain lines which begins with " I"
11.grep "^I" sample1
displayed nothing.^ denotes the beginning of the line.and file does not contain lines which begins with "I"
12.grep "(we|next)" sample1
| for seach multiple patterns.displayed nothing because we need to specify backslash infornt of pipe or we need to use grep -E(if we use -E then just need to give pipe)
13.egrep "(we|next)" sample1
it displayed "Hi there,I hope this day finds you well.
Unfortunately we were not ale to make it to your dinning"
| for seach multiple patterns .egrep is equal to grep -E
14.grep "Inn$" sample1
$ denotes end of the line.Displayed nothing because it searchd for lines which end swith "Inn" and matches does not found in the file.
15.grep "?$" sample1
Displayed nothing.
? means that the preceding item is optional, and if found, will be matched at the most, once.
16.grep "^$" sample1
Displayed nothng.^ denotes the beginning of the line and $ denotes end of the line.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.