Was this helpful?
~
as in "variable ~ /regularexpression/".
This is the "contains" relational operator used in comparison expressions. The example returns true if the regular expression is found anywhere in the variable, false otherwise. The regular expression should always appear on the right of the expression. For more information, see “Comparison Expressions”.
Example 1
$0(4 9) ~ /COD/ { accept $0; }
# Write lines with the pattern COD in columns 4-9
Example 2
if( $0(1 9) ~ /COD/ ) line += $0;
# Append to line if input columns 1-9 contain COD
Last modified date: 12/03/2024