-
Notifications
You must be signed in to change notification settings - Fork 6
bertolet-spurgat submission #7
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
5bb33bc
398b15c
f4ec6ac
15a2819
4d79887
fb1a8a7
b6eadee
180ac6b
5b057ee
8dc898d
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 @@ | ||
| Garden State | ||
| The Princess Bride | ||
| LaLa Land | ||
| Across the Universe | ||
| The Great Gatsby | ||
| Interstellar |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| #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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please read the questions carefully before finishing. Missing uniq at the end of the pipeline. Results should be written to a file. |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| ### Script for getting information about highest and lowest earning people | ||
| ### Usage: bash wagesAnalysis.sh | ||
|
|
||
| # | ||
| 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 | ||
|
|
||
|
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! |
||
| # | ||
| 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 | ||
|
|
||
|
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! |
||
| # | ||
| 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This gives the number of females in the bottom 10. Either use tail -10 or the -r flag in sort. |
||
|
|
||
| # | ||
| echo "Average wage of those with 12 years school:" | ||
| 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 "Average wage of those with 16 years school:" | ||
| cat wages.csv | cut -d "," -f 3,4 | grep "16," | sed 's/,/ /g' | awk '{ sum += $2; n++ } END { if (n > 0) print sum / n; }' | ||
|
|
||
| # | ||
| echo "Difference in wage:" | ||
| 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the question was asking for the difference in minimum wage between genders, but average is OK. Kudos for incorporating awk! |
||
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.
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 :)
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.
2.5/3