Cs288 Intensive Programming in Linux Instructor: C F Yurkoski Christopher.f.yurkoski@njit.edu Section web site: https://web.njit.edu/~yurkowsk/cs288.html Class 5 (going to slowly?) 6-9-15
https://xkcd.com/844/ 6-9-15 cfy
Quiz results Written section 18% Programming sections 10% Overall 14% Lessons learn: leave yourself time to submit your code to Moodle Submit something, even partial credit is better than nothing. We need more electrical outlets in here. 6-9-15 cfy
Homework results Homework 1 average grade 72% Homework 2 70% 6-9-15 cfy
revu 6-9-15 cfy
sample output ./analysis https://web.njit.edu/~yurkowsk/29sept/competitorA https://web.njit.edu/~yurkowsk/29sept/competitorB customerA buys routers and switches customerF buys servers customerG buys routers afsconnect1-159 homework3 >: 6-9-15 cfy
Homework 6 revu part 1: # homework 6 if [ $# -ne 2 ] then echo Usage: $0 competitor1 competitor2 exit 1 fi wget -q $1 -O one wget -q $2 -O two 6-9-15
Homework revu cont cont: cat one | cut -d"," -f 1 | while read customer do grep $customer two done | cut -d"," -f 1 | while read commoncust a=`grep $commoncust one | cut -d"," -f 2` b=`grep $commoncust two | cut -d"," -f 2` let total=a+b if [ $total -gt 100000 ] then echo -n "$commoncust buys " prod1=`grep $commoncust one |cut -d"," -f 3` prod2=`grep $commoncust two |cut -d"," -f 3` if [ $prod1 != $prod2 ] echo $prod1 and $prod2 else echo $prod1 fi done 6-9-15
Complete solution at: https://web.njit.edu/~yurkowsk/x/analysis 6-9-15 cfy
Homework for next week Generalize solution from last week’s homework so that instead of accepting two arguments it accepts an arbitrary number of them. Change the threshold for a potential sales lead from $100,000 to 1,000,000 USD. List the potential sales leads and the products they purchase. Example output: 6-9-15 cfy
/analysis2 https://web. njit /analysis2 https://web.njit.edu/~yurkowsk/29sept/competitorA https://web.njit.edu/~yurkowsk/29sept/competitorB https://web.njit.edu/~yurkowsk/29sept/competitorC https://web.njit.edu/~yurkowsk/29sept/competitorD https://web.njit.edu/~yurkowsk/29sept/competitorE The big spenders are customerA customerD customerG customerH. customerA buys: routers switches customerD buys: customerG buys: customerH buys: afsconnect1-133 ~ >: 6-9-15 cfy
Project revu 6-9-15
In https://web.njit.edu/~yurkowsk/project1/ there are 4 files: https://web.njit.edu/~yurkowsk/project1/names https://web.njit.edu/~yurkowsk/project1/ids https://web.njit.edu/~yurkowsk/project1/hours and https://web.njit.edu/~yurkowsk/project1/rate names contains a list of names, one per line. id contains a list of semicolon separated tuples, one per line consisting of a name and the literal "ID" followed by a numeric id.. hours contains list of semicolon separated tuples, one per line consisting of a numeric id and a number indicating the number hours worked that week. rate contains list of semicolon separated tuples, one per line consisting of a numeric id and an hourly rate for that id. Assume the rate is USD per hour. Your goal is to write a script which calculates the compensation for the names in first file for the week and output the names followed by a tab followed by a dollar sign followed by that name’s pay. Output one name and pay amount per line. The output should be in alphabetical order by name regardless of the order in the “names” file. Write the results to standard out, output any error messages to standard error. Your script should accept 5 command line arguments. The first will be the name of a directory like the one above, the next 4 are assumed be file names in that directory whose contents are formatted as the four URLs above and are in the same order as above.
https://web.njit.edu/~yurkowsk/x/projectone 6-9-15 cfy
6-9-15 cfy
6-9-15 cfy
6-9-15 cfy
Test1 part 1 written Closed book 30 minutes, tests will not be accepted late. For question 6 assume the file input contains the same contents as in question 1. 6-9-15 cfy
Test part 2, problems on moodle. 6-9-15 cfy