Sponsored Content
Full Discussion: please help
Top Forums UNIX for Advanced & Expert Users please help Post 101593 by rajan_ka1 on Friday 10th of March 2006 01:26:07 AM
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
 
dhcpinfo(1)							   User Commands						       dhcpinfo(1)

NAME
dhcpinfo - display values of parameters received through DHCP SYNOPSIS
dhcpinfo [ -c ] [-i interface] [-n limit ] code dhcpinfo [ -c ] [-i interface] [-n limit ] identifier DESCRIPTION
The dhcpinfo utility prints the DHCP-supplied value(s) of the parameter requested on the command line. The parameter may be identified either by its numeric code in the DHCP specification, or by its mnemonic identifier, as listed in dhcp_inittab(4). This command is intended to be used in command substitutions in the shell scripts invoked by init(1M) at system boot. It first contacts the DHCP client daemon dhc- pagent(1M) to verify that DHCP has successfully completed on the requested interface. If DHCP has successfully completed on the requested interface, dhcpinfo retrieves the values for the requested parameter. Parameter values echoed by dhcpinfo should not be used without check- ing its exit status. See EXIT STATUS. See dhcp_inittab(4) for the list of mnemonic identifier codes for all DHCP parameters. See RFC 2132, DHCP Options and BOOTP Vendor Exten- sions for more detail. Output Format The output from dhcpinfo consists of one or more lines of ASCII text; the format of the output depends upon the requested parameter. The number of values returned per line and the total number of lines output for a given parameter are determined by the parameter's granularity and maximum values, respectively, as defined by dhcp_inittab(4). The format of each individual value is determined by the data type of the option, as determined by dhcp_inittab(4). The possible data types and their formats are listed below: Data Type Format dhcp_inittab(4) type Unsigned Number One or more decimal digits UNUMBER8, UNUMBER16, UNUMBER32, UNUMBER64 Signed Number One or more decimal digits, SNUMBER8, SNUMBER16, optionally preceded by a SNUMBER32, SNUMBER64 minus sign IP Address Dotted-decimal notation IP Octet The string "0x" followed by a OCTET two-digit hexadecimal value String Zero or more ASCII characters ASCII OPTIONS
The following options are supported: -c Displays the output in a canonical format. This format is identical to the OCTET format with a granularity of 1. -i interface Specifies the interface to retrieve values for DHCP parameters from. If this option is not specified, the primary interface is used. -n limit Limits the list of values displayed to limit lines. OPERANDS
The following operands are supported: code Numeric code for the requested DHCP parameter, as defined by the DHCP specification. Vendor options are specified by adding 256 to the actual vendor code. identifier Mnemonic symbol for the requested DHCP parameter, as listed in dhcp_inittab(4). EXIT STATUS
The following exit values are returned: 0 Successful operation. 2 The operation was not successful. The DHCP client daemon may not be running, the interface might have failed to configure, or no satisfactory DHCP responses were received. 3 Bad arguments. 4 The operation timed out. 6 Some system error (should never occur). ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsr | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ SEE ALSO
dhcpagent(1M), ifconfig(1M), init(1M), dhcp_inittab(4), attributes(5) Alexander, S., and R. Droms, RFC 2132, DHCP Options and BOOTP Vendor Extensions, Silicon Graphics, Inc., Bucknell University, March 1997. SunOS 5.10 29 Jul 1999 dhcpinfo(1)
All times are GMT -4. The time now is 08:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy