using linux/unix. written in puTTy Provide the commands used to preform the foll
ID: 3717294 • Letter: U
Question
using linux/unix. written in puTTy
Provide the commands used to preform the following tasks
1. Move the roster file to the ~/IFT250/Exams/Final directory.
Mv roster Final
2. Change your working directory to ~/IFT250/Exams/Final.
3. Use vi to replace all commas with spaces and save the file as viRoster.
4. Do the same without vi and save the output as newRoster.
5. Compare the viRoster and newRoster files line by line and display the lines that are different.
6. Find all instances of the word "Technology" in the viRoster and save the output as uglyRoster.
7. Use vi to create a file named head that contains the field names written above, insert the viRoster file into the head file, and save it as badRoster.
8. Format the viRoster file using vi so that it matches the example below and save it as goodRoster.
Last Name:First Name:Student ID:School:Major:Residency:Academic Level:ASURITE
9. Display the number of students in the goodRoster file that are in the IT program.
10. Display the number of students in the goodRoster file that are both a senior and a resident.
:
Explanation / Answer
1.) mv roster /IFT250/Exams/Final/roster ------ to Move the roster file to the ~/IFT250/Exams/Final directory.
2.)cd ~/IFT250/Exams/Final ------------Change your working directory to ~/IFT250/Exams/Final
3.)vi roster -------------open viRoster
i -----------insert mode on
%s/,/ /g ---------search and replace comma with space globally
:x viRoster ------------- save as viRoster
4.) sed 's/,/ /g' roster > newRoster -------------- same as above using sed
5.) diff -u viRoster newRoster > ---------------- display difference between two files
6.)vi viRoster -------------open viRoster
/Technology ------------- find all occurances of word Technology
:x uglyRoster -------------save as uglyRoster
7.)vi head -------------create head
i ----------go to insert mode and copy paste all the field names here
:set paste ----------paste all contents to this
:x badroster -----------save and exit
8.)vi viRoster ------------open viRoster
:x goodRoster
9.)^G goodRoster
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.