I am looking to search a file for a column that is 3 letters followed by any 3 or 4 numerals. eg.
if ( $1 ~ /^[A-Z][A-Z][A-Z][0-9][0-9][0-9]/)
However I need the 3 letters to be a variable, so I am looking for the result of
SP="ABC"
if ( $1 ~ /^/SP/[0-9][0-9][0-9]/)
This however does not work, and I've not found a way to combine a variable and regular expression in the search pattern.
Any help greatly appreciated.
|
|||
|
You can concatenate strings but not
could be seen as the concatenation of But with parenthesis, you can get interesting (read buggy) behaviours:
(that latter one being the result of note that in
|
|||||
|
You can tell awk to read regular expression starting with exact chars, and then with a charater "type" in square brackets, followed by repetition number in curly brackets. Like so:
You could use logical operator
|
|||||||||||||
|