what are the four basic commands (CS140 Linux) 1)Assume you are editing the main
ID: 3733265 • Letter: W
Question
what are the four basic commands (CS140 Linux)
1)Assume you are editing the main.cpp file. Write a vim command to add the contents of the main.h file to the beginning of the main.cpp file. Do not you know the contents of the main.h file.
2)Assume you are editing the main.cpp file. Write a vim command to change the string "Hello WOrld" to "hello world" in every line that begins with the character 's' in the file.
3)Assume you are editing the main.cpp file. Write a vim command to change every occurence of the word "varA" to the word "var.A/"
4)Assume you are editing the main.cpp file. Write a vim command to split every line longer than 40 characters into multiple lines, each of which is no longer than 40 characters (but may be shorter).
Explanation / Answer
Please find my answer for Q1, 2,3
Please repost others in separate post.
1) if you main.cpp file is open and you want to add main.h at the beginning of main.cpp
then
this will insert main.h before the first line of main.cpp
2) :g/^s/s/Hello WOrld/hello world/g
3) :%s/varA/var.A//g
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.