A) 1.Use an awk command to print everyone\'s address. 2.Print everyone\'s salary
ID: 663784 • Letter: A
Question
A) 1.Use an awk command to print everyone's address. 2.Print everyone's salary and get a sum of all the salaries. B) Use sed commands to: 1. Change the area code to 812 2. Delete the lines with people whose address is in CA Tom Blenheim:238-923-7366:95 Dusk Lane, Easton, PA 83755:11/12/56:20300 Jeff Dunnum :245-800-8357:635 Lynhurst, Hollywood, CA 91464:6/23/23:14500 Beth White:385-375-794:3567 Hembre Rd, Marietta, GA 30062:6/18/68:23400 Norma Corder:397-362-7811:74 Pine Street, Dearborn, MI 23874:3/28/45:245700 Jay Cowan:548-834-2348:583 Laurel Ave., Huston, TX 83745:10/1/35:58900 Kakaroit :488-267-0000:123 5th St., San Jose, CA 04086:7/25/53:85100 Karen Evich:284-264-7594:23 Edgecliff Place, Lincoln, NB 92086:7/25/53:85100
Explanation / Answer
A)
1)
$ awk '{print;}' address.txt
by default it prints every line..tha is each addresses
2)
awk -F= '{salary=$2}{print salary}{salaries+=$2};END{print salaries}'
it will print salary..as well as we are making total of all salaries
.............................................................................................................................................
B)
1)
$ sed -i 's/800/812/g' /home/folder/areacode-changed/areacode.txt
this command will search area code 800 and replaces 812......beacuse area code changed (mesagge also put in command) and follwed by file path
2)
sed '/CA/d' address.txt
This command will delete lines...if pattern matches CA as address..
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.