3 ms·
This is a nice little run through of a real life example. Once you realise that awk's model is 'match pattern { do actions; }' everything makes a whole lot mor
by aidos 7y ago
This is a nice little run through of a real life example.
Once you realise that awk's model is 'match pattern { do actions; }' everything makes a whole lot more sense.
- sohkamyung 7y agoAwk also supports BEGIN and END actions that take place at the start and at the end of execution. BEGIN might be used to initialise Awk variables or print initial messages, while END can be used to print a summary of actions at the end. See [1] https://www.grymoire.com/Unix/Awk.html#uh-1 https://www.grymoire.com/Unix/Awk.html#uh-1
- RBerenguel 7y agoYou can also use either BEGIN or END as the only entrypoints, essentially using AWK as you'd use any other programming language. Yes, sometimes this defeats the point of what AWK excels at, but it's good to know.