#159 Awk control file

Create awk control file func1.awk

function green(s) {
    printf "\033[1;32m" s "\033[0m\n"
}
BEGIN {
    FS=":"
    green(" Name: UID: Shell:")
}
{
    printf "%10s %4d %17s\n",$1,$3,$7
}

Command to run awk control file is

awk -f func1.awk /etc/passwd

Discover more from Tips and Hints for Aerospace Engineers

Subscribe now to keep reading and get access to the full archive.

Continue reading