Operating System - Linux
1752812 Members
6110 Online
108789 Solutions
New Discussion юеВ

translate script with command od

 
cariteyp
Occasional Advisor

translate script with command od

Hi all,

I would like to use this function on HPUX, but od -D doesn't work on HP-UX.
Could oyu help me ?

Here the function :

GetLong()
{
# Returns 4-byte unsigned integer.
#
# Parameters:
# $1 - offset in the file;
# $2 - file to read.

# od -D Interpret long words in unsigned decimal:
od -D $2 +$1. | \
awk '{ printf"%d",$2; exit }'

} # GetShort()
3 REPLIES 3
Peter Godron
Honored Contributor

Re: translate script with command od

Hi,
do a man od for full spec.
The -j option specifies the offset.
cariteyp
Occasional Advisor

Re: translate script with command od

I try the man command, but I doesn't find the solution.
Sorry ...
Rodney Hills
Honored Contributor

Re: translate script with command od

The syntax you are using is pre-posix. The posix format would be-

od -t d4 filename

This would dump 4 bytes at a time of of signed decimal

od -t u4 filename

Would dump 4 bytes unsigned decimal

This is described in the "man od".

HTH

-- Rod Hills
There be dragons...