Issue
I've been trying to make a regex match that will match against CPU instructions like:
and val1, val2
sub val1, val2
How can I make a regex that can perform a wildcard in place of both of these values BUT, the two values cannot be the same?
and ...\, ...
sub ...\, ...
But where the first ... !=
the second ...
Solution
Using any awk in any shell on every UNIX box:
awk -F'[ ,]+' '($1 ~ /^(and|sub)$/) && ($2 != $3)' file
Answered By - Ed Morton