I have packed fields for which I am trying to print bytes. when I try cut -b2 it does print the 2nd byte besides that it also prints additional byte that I am not aware off:confused: data looks something like this
yes, I do understand that packed decimals would have unprintable characters. However, I was refering to the bytes in it. so, does that mean cut doesnt work with different formats?
The number 135 is stored as '13' '5F' or '5F' '13" (in packed decimal format) depending on whether is system is big endian or little endian.
To extract half of a byte to get '3' you need to display the field in hexadecimal as '1' '3' '5' 'F', which can be done using hexdump. Then use cut to extract the digit.
Ok, I get the issue here when the cut is printing it is printing the carriage return which is being displayed as { 0A} hex value. here is what I did. I captured the output of cut in a variable and displayed it using awk printf. this has solved my problem.