!~
as in "variable !~ /regularexpression/".
This is the "does not contain" relational operator used in comparison expressions. The expression returns true if the regular expression is not found anywhere within the value assigned to the variable, false otherwise. The regular expression should always appear on the right of the variable. For more information, see “Comparison Expressions”.
Example
$5 !~ /M\.D\./ { ... } # Perform action block if 5th field doesn't # contain M.D.
Example
if( name !~ /M\.D\./ ) prefix = "Mr."; # Set prefix to Mr. when name does not # contain M.D.
Last modified date: 12/03/2024