Hi
I have 2 fields X and Y, both 8 characters long.
When X is passed to my script, the last 1 or 2 characters can be corrupted.
I need to compare X with Y, and pass if
X = Y, or
chars 1...7 of X = chars 1...7 of Y or
chars 1...6 of X = chars 1...6 of Y.
I thought something like
if [[ ${X%?} != ${Y%?} && $X != ${Y%?} ]]
then error
etc etc
would work, but how do I drop off the last 2 chars ?
Hope someone can help.
Please : no awk, it's just not practicable.
I have 2 fields X and Y, both 8 characters long.
When X is passed to my script, the last 1 or 2 characters can be corrupted.
I need to compare X with Y, and pass if
X = Y, or
chars 1...7 of X = chars 1...7 of Y or
chars 1...6 of X = chars 1...6 of Y.
I thought something like
if [[ ${X%?} != ${Y%?} && $X != ${Y%?} ]]
then error
etc etc
would work, but how do I drop off the last 2 chars ?
Hope someone can help.
Please : no awk, it's just not practicable.