bash - Awk regex for a string of exact length that ends in ":" -
i can't regex right:
awk '$6 ~ /:${14}/ {print $6}' file
i need print out 6th field if it's 15 characters long , ends ":".
here's example: oafkq7xs001224:
you need use --posix
as:
awk --posix '{ if ($6 ~ /^.{14}:$/) print $6}' file
from awk
manual page:
interval expressions available if either --posix or --re-interval specified on command line.
Comments
Post a Comment