-
Notifications
You must be signed in to change notification settings - Fork 6
Connor_Shirley Submission #2
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
base: master
Are you sure you want to change the base?
Changes from all commits
85d7603
f9ed96b
d797893
40b0412
8c99fd7
41c2f18
7fccfc4
5b8e218
fac124d
1dbdfda
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| Inception | ||
| The Two Towers | ||
| Gladiator | ||
| The Dark Knight | ||
| Dark Knight Rises | ||
| Fury |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # Takes wages.csv and... | ||
| #1) removes first row, | ||
| #2) only keeps gender and years experience columns, | ||
| #3) sorts unique gender/years experience combinations, | ||
| #4) and writes it to a filename of your choice | ||
|
|
||
| #Usage: bash gender.sh <filenameforoutput> | ||
| echo 'Unique gender and yearsexperience cominations saved to' $1 | ||
| cat wages.csv | sed '1d'| cut -d, -f-1,2 | sort -ut"," -k1,1 -k2n,2 > "$1" | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. correct |
||
|
|
||
| #Returns gender, yearsExperience, and wage for | ||
| #1 highest earner | ||
| #2 lowest earner | ||
| #3 number of females in the top 10 wage earners | ||
|
|
||
| echo 'highest earner:' | ||
| cat wages.csv | grep -v gender | sed 'y/,/ /' | sort -k 4 -n -r | head -n 1 | ||
| echo 'lowest earner:' | ||
| cat wages.csv | grep -v gender | sed 'y/,/ /' | sort -k 4 -n -r | tail -n 1 | ||
| echo 'number of females in the top 10 wage earners:' | ||
| cat wages.csv | grep -v gender | sed 'y/,/ /' | sort -k 4 -n -r | head -n 10 | grep female | wc -l | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct, but if you read the directions carefully, you should have deleted the years schooling column from the returned responses. |
||
|
|
||
| #demonstrates the effect of graduating college on minimum wage | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Kudos for the use of awk! If you read directions carefully, you should have returned minimum, not average wage, but OK. |
||
|
|
||
| #college grad | ||
| cat wages.csv | sed 'y/,/ /' | awk '$3 == "16"' | cut -d " " -f 4 | awk '{s+=$1}END{print "average college graduate minimum wage:",s/NR}' | ||
|
|
||
| #no college education | ||
| cat wages.csv | sed 'y/,/ /' | awk '$3 == "12"' | cut -d " " -f 4 | awk '{s+=$1}END{print "non-college graduate minimum wage:",s/NR}' | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| cat "$1" | sed '1d'| cut -d, -f-1,2 | sort -ut"," -k1,1 -k2n,2 > "$2" | ||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellently commented code! Could use more frequent/useful commit messages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3/3