March 2018
Beginner to intermediate
416 pages
9h 24m
English
The unquoted dollar, $, matches the string at the end of the line. The '$' is only the anchor if it is the last character in the regular expression. For example, '0$' matches all the lines that end with 0. It will print employee details of those whose salary ends with the '0' character in the employee database:
$ awk '/0$/{ print }' emp.dat
The output on execution of this code is as follows:
Jack Singh 9857532312 jack@gmail.com M hr 2000Jane Kaur 9837432312 jane@gmail.com F hr 1800Eva Chabra 8827232115 eva@gmail.com F lgs 2100Amit Sharma 9911887766 amit@yahoo.com M lgs 2350Julie Kapur 8826234556 julie@yahoo.com F Ops 2500Ana Khanna 9856422312 anak@hotmail.com F Ops 2700Hari Singh 8827255666 hari@yahoo.com M ...
Read now
Unlock full access