This is working from the command line:
grep -P --color '\b(?!000)(?!666)(?:[0-6]\d{2}|7(?:[0-356]\d|7[012]))[- ](?!00)\d{2}[- ](?!0000)\d{4}\b' *.txt
The --color shows me it is matching exactly.
What I really need though is to not have the entire line returned. I only need the exact matches returned from inside each line. (like what color is showing me)
So I tried:
awk '/\b(?!000)(?!666)(?:[0-6]\d{2}|7(?:[0-356]\d|7[012]))[- ](?!00)\d{2}[- ](?!0000)\d{4}\b/ { print $0 }' file.text
and I get this error:
awk: illegal primary in regular expression[/color red] \b(?!000)(?!666)(?:[0-6]\d{2}|7(?:[0-356]\d|7[012]))[- ](?!00)\d{2}[- ](?!0000)\d{4}\b at[/color red] !000)(?!666)(?:[0-6]\d{2}|7(?:[0-356]\d|7[012]))[- ](?!00)\d{2}[- ](?!0000)\d{4}\b
source line number 1
context is[/color red]
/\b(?!000)(?!666)(?:[0-6]\d{2}|7(?:[0-356]\d|7[012]))[- ](?!00)\d{2}[- >>> ](?!0000)\d{4}\b/ <<< [/color red]
I believe it ha something to do with either the backtics, or more likely the '!' in the regex.
I am not hung up on using awk, I would be happy to use any tool that might parse just the matched values instead of the entire matched line, so I can dump that to a file.
Any Help, is appreciated:
--Bruce D. Meyer
grep -P --color '\b(?!000)(?!666)(?:[0-6]\d{2}|7(?:[0-356]\d|7[012]))[- ](?!00)\d{2}[- ](?!0000)\d{4}\b' *.txt
The --color shows me it is matching exactly.
What I really need though is to not have the entire line returned. I only need the exact matches returned from inside each line. (like what color is showing me)
So I tried:
awk '/\b(?!000)(?!666)(?:[0-6]\d{2}|7(?:[0-356]\d|7[012]))[- ](?!00)\d{2}[- ](?!0000)\d{4}\b/ { print $0 }' file.text
and I get this error:
awk: illegal primary in regular expression[/color red] \b(?!000)(?!666)(?:[0-6]\d{2}|7(?:[0-356]\d|7[012]))[- ](?!00)\d{2}[- ](?!0000)\d{4}\b at[/color red] !000)(?!666)(?:[0-6]\d{2}|7(?:[0-356]\d|7[012]))[- ](?!00)\d{2}[- ](?!0000)\d{4}\b
source line number 1
context is[/color red]
/\b(?!000)(?!666)(?:[0-6]\d{2}|7(?:[0-356]\d|7[012]))[- ](?!00)\d{2}[- >>> ](?!0000)\d{4}\b/ <<< [/color red]
I believe it ha something to do with either the backtics, or more likely the '!' in the regex.
I am not hung up on using awk, I would be happy to use any tool that might parse just the matched values instead of the entire matched line, so I can dump that to a file.
Any Help, is appreciated:
--Bruce D. Meyer