03-10-2006
130,
1
Join Date: Sep 2005
Last Activity: 30 October 2008, 3:54 AM EDT
Posts: 130
Thanks Given: 0
Thanked 1 Time in 1 Post
please help
dear friends,
I am writing a shell script to convert hexadecimal data in to binary data.
my script is like this.
=====================================
# !/bin/csh -f
grep '2132' tip_20060228_180001.dat > 2132.txt
awk '/2132/ {for (i=6; i<=NF; i++) printf $i" "}' 2132.txt > ra
set array word = `fold -1 ra`
set len = ${#word}
set i = 1
while ($i < $len)
set tmp = $word[$i]
set var = ` echo "ibase=16; obase=2; $tmp" | bc`
printf '%s=%04d\n' $tmp $var
@ i++
end
=================================
in my script i am taking hexdata from file and storing it in array called word.
after that i taken while loop and converting each element in the array into binary form.
and printing the data using printf .
up to this ok.
but instead of printing i want to write this binary data in to one file.
so , i want file like this.
ex:dat.file
11010100111010001011101001011010101000000010101010101010101000101010.
please help.
thanks in advance.
regards
rajan