Migrated From Jp Software Wiki
Awk is a pattern-action language. Perhaps the biggest hurdle to successfully using Awk with TCC is clashes in special characters. To avert excess head-scratching, put your awk scripts in a text file (typically with an extension of .awk), and use the -f {awk_script_filename} option of Awk.
One limitation of awk is that patterns are case-sensitive. To work around that, one can use functions built-in to Awk.
For example, suppose one wanted to print only lines containing the string "Whatever":
To make the pattern case-INsensitive, one can use:
Also be aware that there are many variants of Awk available. Most have some unique features that will not work with other variants.
Awk is a pattern-action language. Perhaps the biggest hurdle to successfully using Awk with TCC is clashes in special characters. To avert excess head-scratching, put your awk scripts in a text file (typically with an extension of .awk), and use the -f {awk_script_filename} option of Awk.
One limitation of awk is that patterns are case-sensitive. To work around that, one can use functions built-in to Awk.
For example, suppose one wanted to print only lines containing the string "Whatever":
Code:
/Whatever/ {print $0}
To make the pattern case-INsensitive, one can use:
Code:
{if (match(tolower($0),"whatever")) print $0}
Also be aware that there are many variants of Awk available. Most have some unique features that will not work with other variants.