In our last article over AWK "Getting started with AWK" see introduced our self's with AWK, now lets try to see how we can create AWK scripts and use them.
Passing your scripts to awk as a command line argument can be very handy for small one-liners, but when it comes to complex, multi-line programs, you'll definitely want to compose your script in an external file. Awk can then be told to source this script file by passing it the -f option. See example:awk -f script.awk file.txt
BEGIN {
FS=":"
}
{ print $1 }
1: bla 23
2: bla 24
3: bla 25