Posts

Showing posts from January, 2018
Getting Started:  Useful awk programs are often short, just a line or two. Suppose you have a file called emp.data that contains the name, pay rate in nrs per hour, and number of hours worked for your employees, one employee record per line, like this: Ramesh       4.00          0 Samjhana   3.75           0 Asmita        4.00           10 Sandesh      5.00           20 Rajesh         4.25           18 Now you want to print the name and pay (rate times hours) for everyone who worked more than zero hours. This is the kind of job that awk is meant for, so it's easy. prakash@prakash-VPCEB490X:~/Desktop$ awk ' $3 > 0 { print $ 1, ...