Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
642 B
9
Indexable
Never
cat >> registerFile.txt << EOF
FirstName|LastName |DOB|EmailId|Contact No
Pranay|Pawar|15-07-2002|pdp@tcs.com|9067620123
Monish|Rajendran|27-02-2001|mr@tcs.com|9284456601
Raj|Mishra|12-09-2001|rkm@tcs.com|8788478341
Abhay|Tomar|07-09-2000|at@tc.com|7535026201
EOF

cat >> flightDetails.txt << EOF
FlightName|Origin|Destination|TravelDate|Price
SpiceJet757|CHN|HYD|3Jan|10000
AkasaAir123|DEL|BGL|3Jan|9000
Indigo667|DEL|HYD|3Jan|13000
AIRIndia667|DEL|HYD|3Jan|16000

awk 'FS="|" {if($2=="DEL" && $3=="BGL" && $4=="3Jan"){print $0}}' flightDetails.txt

awk 'FS="|" {if(NR>1){print $0}}' flightDetails.txt | sort -t '|' -k 5,5nr
Leave a Comment