diff --git a/challenge.sh b/challenge.sh new file mode 100644 index 0000000..2b72f2d --- /dev/null +++ b/challenge.sh @@ -0,0 +1,23 @@ + + +### BELOW THIS IS WHAT OM & THOMAS DID FOR CHALLENGE 2 +for file in *.csv +do + +val1=cat $file |grep "m" |cut -d "," -f 3,4 | grep "12," | cut -d "," -f 2 | tr "\n" " " | perl -ne 'use List::Util qw(sum); @arr = split(" ", $_); print sum(@arr)/@arr."\n"' +val2=cat $file |grep "m" |cut -d "," -f 3,4 | grep "16," | cut -d "," -f 2 | tr "\n" " " | perl -ne 'use List::Util qw(sum); @arr = split(" ", $_); print sum(@arr)/@arr."\n"' +echo "Highest Earner:" +cat $file | head -n1 +cat $file |grep "m"|sort -k4 -n -t, -r| head -n1 + +echo "Lowest Earner:" +cat $file | head -n1 +cat $file |grep "m"|sort -k4 -n -t, -r| tail -n1 + + +echo "Number of Females in Top-10 Earners:" +cat $file |grep "m"|sort -k4 -n -t, -r|head -n10 | grep "female" | wc -l + +echo "Difference in wages between 12 and 16 year degree:" +echo "$val2 - $val1" | bc +done diff --git a/combined_challenge.sh b/combined_challenge.sh new file mode 100644 index 0000000..6e0fe64 --- /dev/null +++ b/combined_challenge.sh @@ -0,0 +1,24 @@ +tail -n +2 wages.csv | sort -k1,1 -k2,2n -t , -u | cut -d , -f1,2 | sed 's/,/ /g' > genyears.txt + + +### BELOW THIS IS WHAT OM & THOMAS DID FOR CHALLENGE 2 +for file in *.csv +do +val1=`cat $file |grep "m" |cut -d "," -f 3,4 | grep "12," | cut -d "," -f 2 | tr "\n" " " | perl -ne 'use List::Util qw(sum); @arr = split(" ", $_); print sum(@arr)/@arr."\n"'` +val2=`cat $file |grep "m" |cut -d "," -f 3,4 | grep "16," | cut -d "," -f 2 | tr "\n" " " | perl -ne 'use List::Util qw(sum); @arr = split(" ", $_); print sum(@arr)/@arr."\n"'` + +echo "Highest Earner:" +cat $file | head -n1 +cat $file |grep "m"|sort -k4 -n -t, -r| head -n1 + +echo "Lowest Earner:" +cat $file | head -n1 +cat $file |grep "m"|sort -k4 -n -t, -r| tail -n1 + + +echo "Number of Females in Top-10 Earners:" +cat $file |grep "m"|sort -k4 -n -t, -r|head -n10 | grep "female" | wc -l + +echo "Difference in wages between 12 and 16 year degree:" +echo "($val2) - ($val1)" | bc +done diff --git a/fav3movies b/fav3movies new file mode 100644 index 0000000..a8ec5a5 --- /dev/null +++ b/fav3movies @@ -0,0 +1,9 @@ +1. Back To The Future +2. The Godfather +3. Rebel One +4. Star Wars +5. Citizen Kane +6. The Dark Knight +7. Rebel One +8. Mothra +9. Cloud Atlas diff --git a/genyears.txt b/genyears.txt new file mode 100644 index 0000000..9b27a0a --- /dev/null +++ b/genyears.txt @@ -0,0 +1,33 @@ +female 1 +female 2 +female 3 +female 4 +female 5 +female 6 +female 7 +female 8 +female 9 +female 10 +female 11 +female 12 +female 13 +female 14 +female 15 +female 16 +male 2 +male 3 +male 4 +male 5 +male 6 +male 7 +male 8 +male 9 +male 10 +male 11 +male 12 +male 13 +male 14 +male 15 +male 16 +male 17 +male 18 diff --git a/unique_genyears.sh b/unique_genyears.sh new file mode 100644 index 0000000..59f36c7 --- /dev/null +++ b/unique_genyears.sh @@ -0,0 +1 @@ +tail -n +2 wages.csv | sort -k1,1 -k2,2n -t , -u | cut -d , -f1,2 | sed 's/,/ /g' > genyears.txt