From f976d9ef7216a746cca49dbc2a87f19b1bbe5968 Mon Sep 17 00:00:00 2001 From: Om Neelay Date: Thu, 21 Sep 2017 13:40:18 -0400 Subject: [PATCH 01/13] fav3movies --- fav3movies | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 fav3movies diff --git a/fav3movies b/fav3movies new file mode 100644 index 0000000..8619c73 --- /dev/null +++ b/fav3movies @@ -0,0 +1,3 @@ +The Godfather +The Dark Knight +Star Wars From 50b7d53054501b6feaf69ab8f6e4b4167d46290f Mon Sep 17 00:00:00 2001 From: Thomas Mitchell Date: Thu, 21 Sep 2017 14:19:03 -0400 Subject: [PATCH 02/13] Thomas added three movies to the text file. --- fav3movies | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fav3movies b/fav3movies index 8619c73..0179d71 100644 --- a/fav3movies +++ b/fav3movies @@ -1,3 +1,6 @@ The Godfather The Dark Knight Star Wars +Titanic +Back to the Future +Citizen Kane From 9cc11f7506ca78b8e9daccc6d9293c56426aa38a Mon Sep 17 00:00:00 2001 From: Andrew Guinness Date: Thu, 21 Sep 2017 15:08:47 -0400 Subject: [PATCH 03/13] update movies --- fav3movies | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fav3movies b/fav3movies index 0179d71..1e7ffea 100644 --- a/fav3movies +++ b/fav3movies @@ -4,3 +4,6 @@ Star Wars Titanic Back to the Future Citizen Kane +Cloud Atlas +Mothra +Rebel One From 94da54c9200d79273ef803810f514febb86a7c9c Mon Sep 17 00:00:00 2001 From: Andrew Guinness Date: Thu, 21 Sep 2017 19:16:31 -0400 Subject: [PATCH 04/13] ranked list added --- fav3movies | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/fav3movies b/fav3movies index 1e7ffea..065106f 100644 --- a/fav3movies +++ b/fav3movies @@ -1,9 +1,9 @@ -The Godfather -The Dark Knight -Star Wars -Titanic -Back to the Future -Citizen Kane -Cloud Atlas -Mothra -Rebel One +1. Cloud Atlas +2. Mothra +3. Rebel One +4. Star Wars +5. Citizen Kane +6. The Dark Knight +7. The Godfather +8. Titanic +9. Back to the Future From 6507627209fd079bc0ea95c080a06aa434987a63 Mon Sep 17 00:00:00 2001 From: Andrew Guinness Date: Thu, 21 Sep 2017 19:50:55 -0400 Subject: [PATCH 05/13] Challenge part 1 --- genyears.txt | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 genyears.txt diff --git a/genyears.txt b/genyears.txt new file mode 100644 index 0000000..624e16c --- /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 11 +female 12 +female 13 +female 14 +female 15 +female 16 +female 17 +female 18 +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 From de2e2e9b8d64fecafcf683cb84d5853705db8518 Mon Sep 17 00:00:00 2001 From: Om Neelay Date: Thu, 21 Sep 2017 21:20:47 -0400 Subject: [PATCH 06/13] OM Changes --- fav3movies | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fav3movies b/fav3movies index 065106f..a8ec5a5 100644 --- a/fav3movies +++ b/fav3movies @@ -1,9 +1,9 @@ -1. Cloud Atlas -2. Mothra +1. Back To The Future +2. The Godfather 3. Rebel One 4. Star Wars 5. Citizen Kane 6. The Dark Knight -7. The Godfather -8. Titanic -9. Back to the Future +7. Rebel One +8. Mothra +9. Cloud Atlas From 791d3d2641bebd6520713c7074c11cfd671fa7a7 Mon Sep 17 00:00:00 2001 From: Om Neelay Date: Thu, 21 Sep 2017 21:56:33 -0400 Subject: [PATCH 07/13] OM and THOMAS challenge question2 --- challenge.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 challenge.sh diff --git a/challenge.sh b/challenge.sh new file mode 100644 index 0000000..d13c8c1 --- /dev/null +++ b/challenge.sh @@ -0,0 +1,18 @@ + + +### BELOW THIS IS WHAT OM & THOMAS DID FOR CHALLENGE 2 +for file in *.csv +do + +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 +done From 11214ba66d520d8131c145a456d18cab965c0947 Mon Sep 17 00:00:00 2001 From: Andrew Guinness Date: Thu, 21 Sep 2017 22:20:05 -0400 Subject: [PATCH 08/13] adding shell script woops --- unique_genyears.sh | 1 + 1 file changed, 1 insertion(+) create mode 100644 unique_genyears.sh 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 From 9b3eba045357f08edf8f19033cf8663351d95678 Mon Sep 17 00:00:00 2001 From: Andrew Guinness Date: Thu, 21 Sep 2017 22:25:41 -0400 Subject: [PATCH 09/13] adding shell woops --- genyears.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/genyears.txt b/genyears.txt index 624e16c..9b27a0a 100644 --- a/genyears.txt +++ b/genyears.txt @@ -6,14 +6,14 @@ female 5 female 6 female 7 female 8 +female 9 +female 10 female 11 female 12 female 13 female 14 female 15 female 16 -female 17 -female 18 male 2 male 3 male 4 From 26275da8aeecbd1f372d17f83361862bed60ea77 Mon Sep 17 00:00:00 2001 From: Andrew Guinness Date: Thu, 21 Sep 2017 22:27:36 -0400 Subject: [PATCH 10/13] combined into a single shell script --- combined_challenge.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 combined_challenge.sh diff --git a/combined_challenge.sh b/combined_challenge.sh new file mode 100644 index 0000000..264731b --- /dev/null +++ b/combined_challenge.sh @@ -0,0 +1,19 @@ +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 + +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 +done From af2d7821dff5908324b94753d8f0a10099b52f84 Mon Sep 17 00:00:00 2001 From: Om Neelay Date: Thu, 21 Sep 2017 22:28:32 -0400 Subject: [PATCH 11/13] Start of challenge 3 --- challenge.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/challenge.sh b/challenge.sh index d13c8c1..2b72f2d 100644 --- a/challenge.sh +++ b/challenge.sh @@ -4,6 +4,8 @@ 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 @@ -15,4 +17,7 @@ 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 From 4afbaaee947c611040fdfe1676588f2cea075ee9 Mon Sep 17 00:00:00 2001 From: Om Neelay Date: Thu, 21 Sep 2017 22:35:23 -0400 Subject: [PATCH 12/13] added in part 1 of part 3 --- combined_challenge.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/combined_challenge.sh b/combined_challenge.sh index 264731b..6bbed5b 100644 --- a/combined_challenge.sh +++ b/combined_challenge.sh @@ -4,6 +4,8 @@ tail -n +2 wages.csv | sort -k1,1 -k2,2n -t , -u | cut -d , -f1,2 | sed 's/,/ / ### 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 @@ -16,4 +18,7 @@ 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 From c347f891c900b375d712e329dd2893a04471ee93 Mon Sep 17 00:00:00 2001 From: Om Neelay Date: Thu, 21 Sep 2017 22:59:36 -0400 Subject: [PATCH 13/13] FINAL --- combined_challenge.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/combined_challenge.sh b/combined_challenge.sh index 6bbed5b..6e0fe64 100644 --- a/combined_challenge.sh +++ b/combined_challenge.sh @@ -4,8 +4,8 @@ tail -n +2 wages.csv | sort -k1,1 -k2,2n -t , -u | cut -d , -f1,2 | sed 's/,/ / ### 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"' +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 @@ -20,5 +20,5 @@ 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 +echo "($val2) - ($val1)" | bc done