unprophete
Technical User
A text file contains hdisk's unique_ids in the following way:
hdisk0 0228B039606ZZZZZZZZZZZ
hdisk1 0228C010606ZZZZZZZZZZZ
------>123456789
1-5 is the hex value I need to convert to dec, and get finally output (last output column in the output is cut 6-9 from second column of the input file):
hdisk0 8843 0396
hdisk1 8844 0106
I did already something working but maybe someone have better or shorter way.
My code is:
$ cat /tmp/ffff
hdisk0 0228B039606ZZZZZZZZZZZ
hdisk1 0228C010606ZZZZZZZZZZZ
$ cat /tmp/ffff|while read a b;do S=`printf "%d\n" 0x$(echo $b|cut -c1-5)`;L=`echo $b|cut -c6-9`;echo $a $S $L;done
hdisk0 8843 0396
hdisk1 8844 0106
$
hdisk0 0228B039606ZZZZZZZZZZZ
hdisk1 0228C010606ZZZZZZZZZZZ
------>123456789
1-5 is the hex value I need to convert to dec, and get finally output (last output column in the output is cut 6-9 from second column of the input file):
hdisk0 8843 0396
hdisk1 8844 0106
I did already something working but maybe someone have better or shorter way.
My code is:
$ cat /tmp/ffff
hdisk0 0228B039606ZZZZZZZZZZZ
hdisk1 0228C010606ZZZZZZZZZZZ
$ cat /tmp/ffff|while read a b;do S=`printf "%d\n" 0x$(echo $b|cut -c1-5)`;L=`echo $b|cut -c6-9`;echo $a $S $L;done
hdisk0 8843 0396
hdisk1 8844 0106
$