Skip to content

bertolet-spurgat submission#7

Open
chloespurgat wants to merge 10 commits into
mdoellma:masterfrom
brittnibertolet:master
Open

bertolet-spurgat submission#7
chloespurgat wants to merge 10 commits into
mdoellma:masterfrom
brittnibertolet:master

Conversation

@chloespurgat

Copy link
Copy Markdown

No description provided.

Comment thread gender-yearsExperience.sh
#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

@mdoellma mdoellma Oct 6, 2017

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The 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.
-0.25 pts

Comment thread gender-yearsExperience.sh
@@ -0,0 +1,5 @@
#sort wages.csv by gender then years experience

Copy link
Copy Markdown
Owner

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 :)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

2.5/3

Comment thread 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

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

correct!

Comment thread wagesAnalysis.sh
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

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

correct!

Comment thread wagesAnalysis.sh
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

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The 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!

Comment thread wagesAnalysis.sh

#
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

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The 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.
-0.25 pts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants