How to convert decimal value to hex and than take 1st digits as variable
sample data
84844294,5,6
51291736,2,3
84844294,5,6
51291736,2,3
i can use
{printf "%x,%d\n",$1,$2}
but than i want to filter base on 1st hex digit 1st recrd
How to convert decimal value to hex and than take 1st digits as variable
sample data
84844294,5,6
51291736,2,3
84844294,5,6
51291736,2,3
i can use
{printf "%x,%d\n",$1,$2}
but than i want to filter base on 1st hex digit 1st recrd
This command filters on first hex digit of first field field, could you be more explicit as I suspect you're not saying what you require precisely.
[skrynesaver@busybox ~]$ awk -F, '{$hex_rec=sprintf("%x,%d\n",$1,$2);if ($hex_rec ~/^[3]/) print $hex_rec;}' ~/tmp/tmp.dat
30ea658,2
30ea658,2