Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions question2script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#you need to initially remove header line from csv file to function properly
#usage: bash question2script.sh filename

echo "highest earner in $1"
sort -k4,4n -t , $1 | tail -n 1 | cut -d , -f 1,2,4
echo "lowest earner in $1"
sort -k4,4n -t , $1 | head -n 1 | cut -d , -f 1,2,4
echo "number females in top 10 earners"
sort -k4,4n -t , $1 | tail -n 10 >temporarYfile.csv
grep fe temporarYfile.csv | wc -l
rm temporarYfile.csv

9 changes: 9 additions & 0 deletions question3script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#you need to intially remove header line from csv file to function properly
#usage: bash question3script.sh filename years_of_education1 years_of_education2

echo "difference between $3 and $2 years of education upon salary"
sort -k3,3n -t , $1 | cut -d , -f 3,4 > newwagesfile.csv
VAR2=$(grep $3, newwagesfile.csv | sort -k2,2n -t , | head -n 1 | cut -d , -f 2)
VAR3=$(grep $2, newwagesfile.csv | sort -k2,2n -t , | head -n 1 | cut -d , -f 2)
echo "$VAR2-$VAR3" | bc
rm newwagesfile.csv
Loading