-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPS2
More file actions
83 lines (51 loc) · 2.16 KB
/
Copy pathPS2
File metadata and controls
83 lines (51 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# How many delayed flights?
echo How many delayed flights?
## Delayed departures
awk -F, '{if($3~"GNV" && $13==1){print $13}}' flights.May2017-Apr2018.csv | awk '{s+=$1}END{print "departuredelays=" s}'
echo ""
## Delayed arrivals
awk -F, '{if($7~"GNV" && $16==1){print $16}}' flights.May2017-Apr2018.csv | awk '{s+=$1}END{print "arrivaldelays=" s}'
echo ""
# How many flights from GNV to other airports
## to ATL
echo How many flights from GNV to other airports?
awk -F, '{if($7~"GNV" && $3~"ATL"){print $7}}' flights.May2017-Apr2018.csv | wc -l && echo GNVtoATL
echo ""
## to CLT
awk -F, '{if($7~"GNV" && $3~"CLT"){print $7}}' flights.May2017-Apr2018.csv | wc -l && echo GNVtoCLT
echo ""
## to MIA
awk -F, '{if($7~"GNV" && $3~"MIA"){print $7}}' flights.May2017-Apr2018.csv | wc -l && echo GNVtoMIA
echo ""
echo How many flights delayed from GNV to other airports
## to ATL
awk -F, '{if($7~"GNV" && $3~"ATL" && $13==1){print}}' flights.May2017-Apr2018.csv | wc -l && echo GNVtoATL
echo ""
## to CLT
awk -F, '{if($7~"GNV" && $3~"CLT" && $13==1){print}}' flights.May2017-Apr2018.csv | wc -l && echo GNVtoCLT
echo ""
## to MIA
awk -F, '{if($7~"GNV" && $3~"MIA" && $13==1){print}}' flights.May2017-Apr2018.csv | wc -l && echo GNVtoMIA
echo ""
#####Flights delayed due to weather from GNV to other airports
echo How many flights delayed due to weather from GNV to other airports
## to ATL
awk -F, '{if($7~"GNV" && $3~"ATL" && $24>0){print}}' flights.May2017-Apr2018.csv | wc -l && echo GNVtoATL
echo ""
## to CLT
awk -F, '{if($7~"GNV" && $3~"CLT" && $24>0){print}}' flights.May2017-Apr2018.csv | wc -l && echo GNVtoCLT
echo ""
## to MIA
awk -F, '{if($7~"GNV" && $3~"MIA" && $24>0){print}}' flights.May2017-Apr2018.csv | wc -l && echo GNVtoMIA
echo ""
##All unique airport codes
echo Unique airport codes
awk -F, '{print $3}' flights.May2017-Apr2018.csv | sort | uniq
echo ""
## All cities in Florida with airports from the data set
echo Florida airport
awk -F, '{if($5~"FL"){print$4}}' flights.May2017-Apr2018.csv | sort | uniq
# Bonus Question
echo "Enter an airport name or state or city >"
read x
awk -v pat=$x -F, '{if($3~pat||$4~pat||$5~pat){print}}' testflights.txt | wc -l