bertolet-spurgat submission#7
Open
chloespurgat wants to merge 10 commits into
Open
Conversation
mdoellma
reviewed
Oct 6, 2017
| #sort wages.csv by gender then years experience | ||
| #usage bash gender-yearsExperience | ||
|
|
||
| cat wages.csv | cut -f 1,2 -d "," | sed 's/,/ /g' | sort -k 1,1d -k 2,2n |
Owner
There was a problem hiding this comment.
Please read the questions carefully before finishing. Missing uniq at the end of the pipeline. Results should be written to a file.
-0.25 pts
mdoellma
reviewed
Oct 6, 2017
| @@ -0,0 +1,5 @@ | |||
| #sort wages.csv by gender then years experience | |||
Owner
There was a problem hiding this comment.
When provided, comments in code are descriptive. Please comment code consistently across script.
Work on providing more descriptive commit messages for collaborators and future you :)
mdoellma
reviewed
Oct 6, 2017
| echo "Highest earner:" | ||
| ### Gets the gender, yearsExperience, and wages of the highest earner | ||
| cat wages.csv | sed 's/,/ /g' | sort -k 4 -n | tail -1 | cut -d " " -f1,2,4 | ||
|
|
mdoellma
reviewed
Oct 6, 2017
| echo "Lowest earner:" | ||
| ### Gets the gender, yearsExperience, and wages of the lowest earner | ||
| cat wages.csv | sed 's/,/ /g' | sort -k 4 -n | head -2 | grep -v "gender" | cut -d " " -f1,2,4 | ||
|
|
mdoellma
reviewed
Oct 6, 2017
| VAR1="$(cat wages.csv | cut -d "," -f 3,4 | grep "16," | sed 's/,/ /g' | awk '{ sum += $2; n++ } END { if (n > 0) print sum / n; }')" | ||
| VAR2="$(cat wages.csv | cut -d "," -f 3,4 | grep "12," | sed 's/,/ /g' | awk '{ sum += $2; n++ } END { if (n > 0) print sum / n; }')" | ||
|
|
||
| echo "$VAR1 - $VAR2" | bc |
Owner
There was a problem hiding this comment.
I think the question was asking for the difference in minimum wage between genders, but average is OK. Kudos for incorporating awk!
mdoellma
reviewed
Oct 6, 2017
|
|
||
| # | ||
| echo "Number of females in the top 10 earners:" | ||
| cat wages.csv | sed 's/,/ /g' | sort -k 4 -n | grep -v "gender" | head -10 | cut -d " " -f1,2,4 | grep "female"| wc -l |
Owner
There was a problem hiding this comment.
This gives the number of females in the bottom 10. Either use tail -10 or the -r flag in sort.
-0.25 pts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.