Vi 1) Redraw/refresh the vi screen. 2) Join lines 1 and 2 of the file. 3) Replac
ID: 3889938 • Letter: V
Question
Vi
1) Redraw/refresh the vi screen.
2) Join lines 1 and 2 of the file.
3) Replace each occurrence of // with ** with a single substitution command.
4) Insert a 5 into the fifth column of all lines containing at least 5 letters using a single substitution command.
5) Add @@ to the beginning of lines 1-30 (do not remove anything) using a single substitution command.
6) Add +++ to the end of the line for lines 31 to EOF (do not remove anything) using a single substitution command.
7) Cut the first 20 lines of the file and paste them at the end of the file. Use the named buffer 'a' for these commands.
8) Set a marker called 'b' at line 20.
9) Move the cursor to the end of the current line. Do NOT go into insert mode.
10) Move the cursor to the end of the file. Do NOT go into insert mode.
11) Go to the line where marker 'b' is set using the line mark syntax (e.g. 20G or :20 is NOT an acceptable answer).
12) Execute the command 'ls -l' on the file WITHOUT exiting vim. Do NOT replace any lines with the output of the ls command.
Explanation / Answer
Answering 4 questions as guidelines are to answer 4 or more in case multiple questions are asked in one question.
1) ctrl+L. if this doesn't work then :redraw!
2)
export $line1 = awk 'NR==1' file
export $line2 = awk 'NR==2' file
echo $line1 $line2
you can use sed also or u can directly join them also.
3) any of below command will work
4)
the first '5' is the thing you want to insert and second 5 is the column number. if you want to insert different char at different columns then you can do that also by separating them with semi-colon.
for example:
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.