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 

command in action

from awk manual page:

interval expressions available if either --posix or --re-interval specified on command line.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

c++ - How to modify context menu of internet explorer using IDocHostUIHandler::ShowContextMenu? -

c# - Asterisk click to call -