Skip to content

mccown-midlige submission#3

Open
pjlmac wants to merge 18 commits into
lyy005:masterfrom
pjlmac:master
Open

mccown-midlige submission#3
pjlmac wants to merge 18 commits into
lyy005:masterfrom
pjlmac:master

Conversation

@pjlmac

@pjlmac pjlmac commented Sep 21, 2017

Copy link
Copy Markdown

Thanks for accommodating our absences, YY!
-Phil

Comment thread Exercise4A.sh
@@ -0,0 +1,3 @@
grep -w "female" wages.csv | cut -d , -f1,2 | tr ',' ' ' | sort -n -k2 | uniq >> Wages1.txt
grep -w "male" wages.csv | cut -d , -f1,2 | tr ',' ' ' | sort -n -k2 | uniq >> Wages1.txt

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.

Alternatively, you can sort by the first column and then the second column with command sort:
sort -k1,1d -k2,2n

Comment thread exercise4B.sh

#To return number of female wage earners to stdout

var1=$(cat $filename | sort -k4 -n | cut -d ',' -f1,2,4 | head -n 2 | tail -n 1)

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.

Sort doesn't work with csv format. You may want to replace "," with " " first:
cat wages.csv | grep -v "gender" | tr "," " " | sort -n -k 4 | tail -n 1 | cut -d " " -f 1,2,4 | tr " " ","

-0.25 point

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.

2 participants