Consider the file classroster shown in the last page of this exam. Now we need to write a awk script,exam.awk, to perform the tasks in Part I above.
The breakdown of the problem is described below. Write your awk script according to those steps.
You will run the script from the command prompt with the following command:
$ awk –f exam.awk classroster
Pre-processing tasks
Insert the header line below in the output:
Student ID, Posting ID, First Name, Last Name, Units, Grade Basis, Program and Plan, Academic Level, ASURITE, Residency, Email
Set the field separator to the appropriate character
For each record,
Create a formatted file, called iclassroster, that looks as shown below:
Last Name : First Name : Student ID : Program and Plan : Academic Level : ASURITE
Use if … elseif … else construct to track the number of
Students in the class from IT program
Freshman
Junior
Sophomore
Senior
Post-Bacc Undergraduate
Students from neither of the above listed academic levels
Create a new field called Email that is made of ASURITE@asu.edu
Print the new record, which includes the new field
Finally
Display the total number of records
Display the number of students from IT Program
Display the number of Freshman
Display the number of Junior
Display the number of Sophomore
Display the number of Senior
Display the number of Post-Bacc Undergraduate
Display the number of Students from other academic levels
(Partial) Roster file
“1209480997”,”0997-464″,”Anthony”,”Alvarado”,”3″,”Standard”,”Ira A Fulton Engineering – Information Technology”,”Senior”,”aalvar33″,”Non-Resident”,
“1201390350”,”0350-574″,”Gibran”,”Alvarez”,”3″,”Standard”,”Ira A Fulton Engineering – Information Technology”,”Junior”,”galvare2″,”Resident”,
“1000746988”,”6988-522″,”Glen”,”Angus”,”3″,”Standard”,”Ira A Fulton Engineering – Information Technology”,”Junior”,”gangus”,”Non-Resident”,
“1207146326”,”6326-608″,”Cole”,”Ashby”,”3″,”Standard”,”Ira A Fulton Engineering – Information Technology”,”Senior”,”cashby”,”Non-Resident”,
“1000548822”,”8822-019″,”Allan”,”Bailey”,”3″,”Standard”,”Ira A Fulton Engineering – Information Technology”,”Senior”,”asu41981″,”Resident”,
“1208428789”,”8789-773″,”Rudy”,”Barron”,”3″,”Standard”,”Ira A Fulton Engineering – Information Technology”,”Junior”,”rrbarron”,”Non-Resident”,
“1208427112”,”7112-644″,”Jeffrey”,”Box”,”3″,”Standard”,”Ira A Fulton Engineering – Information Technology”,”Post-Bacc Undergraduate”,”jabox1″,”Non-Resident”,
“1206996878”,”6878-146″,”Nicholas”,”Burden”,”3″,”Standard”,”Ira A Fulton Engineering – Information Technology”,”Senior”,”nbburden”,”Non-Resident”,
“1200663364”,”3364-155″,”Kurtis”,”Camiliere”,”3″,”Standard”,”Ira A Fulton Engineering – Information Technology”,”Senior”,”kcamilie”,”Resident”,
“1000830925”,”0925-792″,”Michael”,”Camp”,”3″,”Standard”,”Ira A Fulton Engineering – Information Technology”,”Senior”,”mcamp1″,”Resident”,
“1000727027”,”7027-763″,”Robert”,”Carleton”,”3″,”Standard”,”Ira A Fulton Engineering – Information Technology”,”Junior”,”rcarleto”,”Resident”,
“1001460822”,”0822-945″,”Dustin”,”Cartwright”,”3″,”Standard”,”Ira A Fulton Engineering – Tech Entrepreneurship & Mgmt”,”Senior”,”dbcartwr”,”Resident”,
“1201860560”,”0560-486″,”John”,”Cook”,”3″,”Standard”,”Ira A Fulton Engineering – Information Technology”,”Senior”,”jrcook7″,”Resident”,
“1207331615”,”1615-810″,”Thomas”,”Debiasio”,”3″,”Standard”,”Ira A Fulton Engineering – Software Engineering”,”Post-Bacc Undergraduate”,”tdebiasi”,”Non-Resident”,
“1208487705”,”7705-285″,”Jason”,”Dixon”,”3″,”Standard”,”Ira A Fulton Engineering – Software Engineering”,”Junior”,”jadixon5″,”Non-Resident”,
“1207627963”,”7963-539″,”Jose”,”Fernandez”,”3″,”Standard”,”Ira A Fulton Engineering – Information Technology”,”Post-Bacc Undergraduate”,”jlferna4″,”Non-Resident”
(Partial) classroster
1209480997,0997-464,Anthony,Alvarado,3,Standard,Ira A Fulton Engineering – Information Technology,Senior,aalvar33,Non-Resident,
1201390350,0350-574,Gibran,Alvarez,3,Standard,Ira A Fulton Engineering – Information Technology,Junior,galvare2,Resident,
1000746988,6988-522,Glen,Angus,3,Standard,Ira A Fulton Engineering – Information Technology,Junior,gangus,Non-Resident,
1207146326,6326-608,Cole,Ashby,3,Standard,Ira A Fulton Engineering – Information Technology,Senior,cashby,Non-Resident,
1000548822,8822-019,Allan,Bailey,3,Standard,Ira A Fulton Engineering – Information Technology,Senior,asu41981,Resident,
1208428789,8789-773,Rudy,Barron,3,Standard,Ira A Fulton Engineering – Information Technology,Junior,rrbarron,Non-Resident,
1208427112,7112-644,Jeffrey,Box,3,Standard,Ira A Fulton Engineering – Information Technology,Post-Bacc Undergraduate,jabox1,Non-Resident,
1206996878,6878-146,Nicholas,Burden,3,Standard,Ira A Fulton Engineering – Information Technology,Senior,nbburden,Non-Resident,
1200663364,3364-155,Kurtis,Camiliere,3,Standard,Ira A Fulton Engineering – Information Technology,Senior,kcamilie,Resident,
1000830925,0925-792,Michael,Camp,3,Standard,Ira A Fulton Engineering – Information Technology,Senior,mcamp1,Resident,
1000727027,7027-763,Robert,Carleton,3,Standard,Ira A Fulton Engineering – Information Technology,Junior,rcarleto,Resident,
1001460822,0822-945,Dustin,Cartwright,3,Standard,Ira A Fulton Engineering – Tech Entrepreneurship & Mgmt,Senior,dbcartwr,Resident,
1201860560,0560-486,John,Cook,3,Standard,Ira A Fulton Engineering – Information Technology,Senior,jrcook7,Resident,
1207331615,1615-810,Thomas,Debiasio,3,Standard,Ira A Fulton Engineering – Software Engineering,Post-Bacc Undergraduate,tdebiasi,Non-Resident,
1208487705,7705-285,Jason,Dixon,3,Standard,Ira A Fulton Engineering – Software Engineering,Junior,jadixon5,Non-Resident,
1207627963,7963-539,Jose,Fernandez,3,Standard,Ira A Fulton Engineering – Information Technology,Post-Bacc Undergraduate,jlferna4,Non-Resident,
1207103803,3803-346,Hunter,Hale,3,Standard,Ira A Fulton Engineering – Information Technology,Junior,hehale,Non-Resident,
1207033252,3252-936,Thane,Heisey,3,Standard,Ira A Fulton Engineering – Information Technology,Junior,theisey,Non-Resident,
1000527662,7662-261,Jeremy,Hoyle,3,Standard,Ira A Fulton Engineering – Information Technology,Junior,jhoyle,Resident,
1201654029,4029-669,Parker,Jardine,3,Standard,Ira A Fulton Engineering – Information Technology,Post-Bacc Undergraduate,pjardine,Resident,
1000745321,5321-390,Joshua,Johnson,3,Standard,Ira A Fulton Engineering – Information Technology,Junior,jrjohnso,Resident,
1207997618,7618-802,Chinmingnon,Kone,3,Standard,Ira A Fulton Engineering – Information Technology,Junior,cdkone,Non-Resident
Expert Answer
NOTE: Here is the script for your awk assignment. I have attached screenshot of the output as well. Please check and let me know if you find any issues/concerns. I will revert back within 24 hours.
Code:
http://pasted.co/c3c25157
Code output screenshot:
https://pasteboard.co/GEXhKnH.png
https://pasteboard.co/GEXhR40.png