I want to make sure a file follows the following pattern:
... ... ... foo ... foo_KO ... ...
... bar ... ... ... ... bar_KO ...
The file is extremely long, so, in other words, I want to make sure of the following rule, in sed terms:
Every time ([a-z]*)_KO is matched, there is another field on the same line whose value is \1.
I hoope I'm clear enough.
I'm on Solaris 10, using ksh.
Example:
intput
... ... ... foo ... foo_KO ... ...
... bar ... ... ... ... bar_KO ...
output
valid
input
... ... ... foo ... foo_KO ... ...
... bar ... ... ... ... bar_KO ...
... fubar_KO ... ... ... ... ...
output
invalid line 3
or
unmatched pattern fubar_KO