I have a regex that works fine in awk
, but first I need to store the regex in a shell variable
valLat="^[-+]?(([0-9]+[d])?([0-9]+['])?([0-9]*[.]?[0-9]+[\"])?|[0-9]*[.]?[0-9]+)[NnSs]?$"
then pass the shell variable to an awk
variable like this
echo 39d41\'17.766\"N | awk -v valLat=$valLat '{ if ($1 ~ valLat) print $1; else print "erro" }'
39d41'17.766"N
This works, but I want do this without using a shell variable. I've tried to use the escape "\" preceding the special characters without success.