forked from katiemeis/exercise5_assignment
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.sch
More file actions
19 lines (13 loc) · 687 Bytes
/
Copy pathscript.sch
File metadata and controls
19 lines (13 loc) · 687 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash
#bash script.sch wages.csv
cat $1 | cut -d , -f 1,2 | tr ',' ' ' | sort -t ' ' -k1,1 -k2,2 -n > $1_unique.csv
echo "highest earner"
cat $1 | grep -v 'gender' | sort -t , -k 4 -n | tail -n 1
echo "lowest earner"
cat $1 | grep -v 'gender' | sort -t , -k 4 -n | head -n 1
echo "top ten female earners"
cat $1 | grep -v 'gender' | sort -t , -k 4 -n | tail -n 10 | grep -c 'female'
echo "effect of graduating college on minimum wage"
VAR1=$(cat $1 | grep -E '[female|male][,][0-9]{1,4}[,]16' | sort -t , -k 4 -n | head -n 1 | cut -d , -f 4)
VAR2=$(cat $1 | grep -E '[female|male][,][0-9]{1,4}[,]12' | sort -t , -k 4 -n | head -n 1 | cut -d , -f 4)
echo "$VAR1-$VAR2" |bc