March 2018
Beginner to intermediate
416 pages
9h 24m
English
We can write self-contained AWK scripts to execute AWK commands, like we have with shell scripts to execute shell commands. We create the AWK script by using #!, followed by the absolute path of the AWK interpreter and the -f optional argument. The line beginning with #! tells the operating system to run the immediately-followed interpreter with the given argument and the full argument list of the executed program. For example, we can update the cmd.awk file to emp.awk, as follows:
$ vi emp.awk#!/usr/bin/awk -fBEGIN { print "***Emp Info***" }{ print }
Give this file executable permissions (with the chmod utility), then simply run ./emp.awk empinfo.txt at the shell and the system will run AWK as if you ...
Read now
Unlock full access