Question
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
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 assume 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).
5. 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), and do not split any quoted strings.
6. Assume you are editing the main.cpp file. Write a vim command to change every singular "<" symbol to a double quote ("), but do not convert any double "<" symbols, i.e. leave the "<<" operators alone.
7. Assume you are editing the main.cpp file. Write a vim command to replace all newline characters (' ') with semicolons (;). The result should be a file with a single line containing ";" characters where the newlines used to be.
8. Assume you are editing the main.h file. Write a vim command to append the contents of main.cpp to the end of the main.h file. Do not assume you know the contents of the main.cpp file.
9. Assume you are editing the main.h file. Write a vim command to change the case of every character, i.e. all lower-case characters become upper-case characters, and all upper-case characters become lower-case characters.
10. Assume you are running vim with no file. Write a sequence of vim commands that will merge the main.h and main.cpp files into a single file, and then write the merged file to "main.cpp" in your home directory.
There are two files referenced in the questions, and both files are located in the /home/inst/charles.james/CS277_Files directory. The file referred to as main.cpp is /home/inst/charles.james/CS277_Files/main.cpp and the file referred to as main.h is /home/inst/charles.james/CS277_Files/main.h
All questions assume new versions of these files. In other words, each question is independent of the others.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started