-
Notifications
You must be signed in to change notification settings - Fork 9
Bruzzese-Nemera-Inskeep 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
7c4dfd8
cbc84ec
dcc7ea0
27c3a6c
a448d12
8de9783
798ca1c
c9258d1
fd21ce2
cbcbeaf
20fcb05
06c90aa
7f4ed70
fe637d8
ccb2e39
9f24725
eafebdc
b1b7281
40ee888
a2e2227
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,36 @@ | ||
| #Q1 | ||
| #write a file containing unique gender and years experience in two space deliminated columns | ||
| #input = wages.csv | ||
| #output uni.gen.exp.csv | ||
| cat wages.csv | cut -d ',' -f1,2 | sed 's/\<[0-9]\>/0&/' | sed 's/,/ /g' > a.tmp.csv | ||
| head -1 a.tmp.csv > u.gender.year.csv | ||
| sed '1d' a.tmp.csv | sort -n | uniq >>u.gender.year.csv | ||
| rm a.tmp.csv | ||
| echo "unique gender and experience .csv complete" | ||
|
|
||
| #Q2 | ||
| #Print gender, yearsExperience, and wage for highest earner | ||
| echo "Highest Earner" | ||
| cat wages.csv | sed 's/,/ /g' | cut -d ' ' -f 1,2,4 | sort -n -k 3 | tail -1 | ||
|
|
||
| #Print gender, yearsExperience, and wage for lowest earner | ||
| echo "Lowest Earner" | ||
| cat wages.csv | sed 's/,/ /g' | cut -d ' ' -f 1,2,4 | sort -n -k 3 | head -2 | tail -1 | ||
|
|
||
| #Number of females in top 10 earners | ||
| echo "Number of Females in Top 10 Earners" | ||
| cat wages.csv | sed 's/,/ /g' | sort -n -k 4 | tail -10 | grep "female" | wc -l | ||
|
|
||
| #Q3 | ||
| #Minimum wages of 12 vs 16 years school | ||
| val1=$(cat wages.csv | sed 's/,/ /g' | awk -F, '$3 = "12"' | sort -n -k "4" | cut -d ' ' -f 4 | head -2 | tail -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. You already replaced "," to " ". So for awk, you may want to use: awk -F ' ' Then the command would be: -0.25 points for this question |
||
| val2=$(cat wages.csv | sed 's/,/ /g' | awk -F, '$3 = "16"' | sort -n -k "4" | cut -d ' ' -f 4 | head -2 | tail -1) | ||
| echo "Min wage 12 years school" | ||
| echo $val1 | ||
| echo "Min wage 16 years school" | ||
| echo $val2 | ||
| #Difference in wages based on school years | ||
| echo "$val2 - $val1" | bc | ||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| National Treasure | ||
| Pan's Labyrinth | ||
| Lord of the Rings | ||
| The Dark Knight | ||
| Pride and Prejudice | ||
| The Room | ||
| The Devil Wears Prada | ||
| The Lorax | ||
| Revenge of the Sith |
Uh oh!
There was an error while loading. Please reload this page.
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.
Alternatively, you can use:
cat wages.csv | grep -v gender | cut -d , -f 1,2 | sort -u | tr ',' ' ' | sort -k1,1d -k2,2n >categories.txt