I just can't get the regex right:
awk '$6 ~ /:${14}/ {print $6}' file
I need to print out the 6th field if it's 15 characters long and ends with a ":".
Here's an example: oAFKq7XS001224:
You need to use --posix
as:
awk --posix '{ if ($6 ~ /^.{14}:$/) print $6}' file
From awk
manual page:
Interval expressions are only available if either --posix or --re-interval is specified on the command line.