-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExercise 6.rtf
More file actions
21 lines (14 loc) · 769 Bytes
/
Exercise 6.rtf
File metadata and controls
21 lines (14 loc) · 769 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Question 1
cat wages.txt | cut -d , -f 1,2 | sort -d -k 1,1 -k 2n,2n| tr ',' ' ' | uniq > question_1.txt
# Question 2
#Highest Earner code:
cat wages.txt | cut -d , -f 1,2,4 | sort -t, -k 3 -n | tail -n 1
#Lowest Earner code:
cat wages.txt | cut -d , -f 1,2,4 | sort -t , -k 3 -n | head -n 3 | tail -n -1
#Top Earning Females code:
cat wages.txt | cut -d , -f 1,2,4 | sort -t , -k 3 -n -r | head -n 20 |head -n 11 | grep "female" | wc -l
# Question 3
HighSchool = $(cat wages.txt | cut -d , -f 3,4 | grep -w "12" | sort -t, -k 2 -n |head -n 1 | cut -d , -f 2)
College = $(cat wages.txt | cut -d , -f 3,4 | grep -w “16” | sort -t, -k 2 -n |head -n 1 | cut -d , -f 2)
echo “Difference of High School and College”
echo “$HighSchool - $College” | bc