I wanted to mask the bits in a file in linux as follows:
actual : 00-00000000-00000011-00110010-10000000
expect : 00-00000000-00000001-01101010-00000000
error : 00-00000000-00000010-01011000-00000000
In the output, the actual
part should be as it is unless, the error
is 1
then actual
bits should be masked with X
As it is seen, error
is XOR of actual
and expected
data.
Output should look somewhat like this:
output : 00-00000000-000000X1-0X1XX010-10000000
Is there anyway of doing this using SED,AWK,etc commands?
What is done so far:
grep 'err' gpbat | sed 's?-??g' | cut -c 11-35 | sed 's?1?X?g' > a1
grep 'act' gpbat | sed 's?-??g' | cut -c 11- > a2
But from here, not getting how to merge a1
& a2