awk - first script
first.awk
Enter the following in a file called first.awk
#!/bin/awk -f
# this is the top of the script
BEGIN { FS=":" }
# now let's do some processing
{ print "UID", $3, "belongs to", $1 }
#here is the end of the line
END { print "+++++++++++++++++++" }
Save this file and run it with the /etc/passwd file as an argument
$ awk -f first.awk /etc/passwd
second.awk
Enter the following in a file called second.awk
#!/bin/awk -f
BEGIN { FS=":" }
{ print "UID", $3, "belongs to", $1 }
END { print "+++++++++++++++++++" }
Save this file and make it executable and run it with the /etc/passwd file as an argument
$ chmod u+x second.awk
$ first.awk /etc/passwd