please help


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users please help
# 1  
Old 03-10-2006
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
# 2  
Old 03-13-2006
dear friends,

anyone, please help me ......

waiting for reply.
# 3  
Old 03-13-2006
hi

i think u can use [variable name]>>filename

$tmp $var >> filename
si it will insert all extracted informtion to a file.

Regards,
Swapneel
# 4  
Old 03-13-2006
hi

i think u can use [variable name]>>filename

$tmp $var >> filename
si it will insert all extracted informtion to a file.

Regards,
Swapneel
# 5  
Old 03-14-2006
thank u friend,


it is working .
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question