Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

guinness-neelay-mitchell submission #8

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
23 changes: 23 additions & 0 deletions challenge.sh
Original file line number Diff line number Diff line change
@@ -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
24 changes: 24 additions & 0 deletions combined_challenge.sh
Original file line number Diff line number Diff line change
@@ -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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job

9 changes: 9 additions & 0 deletions fav3movies
Original file line number Diff line number Diff line change
@@ -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
33 changes: 33 additions & 0 deletions genyears.txt
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions unique_genyears.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tail -n +2 wages.csv | sort -k1,1 -k2,2n -t , -u | cut -d , -f1,2 | sed 's/,/ /g' > genyears.txt