From: "TyBreaker" <tybreaker@hotmail.com>
Subject: Re: A little UNIX scripting challenge...
Date: Fri, 28 May 2004 05:22:37 GMT [thread overview]
Message-ID: <newscache$p9seyh$zzh$1@lead.sge.net> (raw)
In-Reply-To: 60fdd9c9.0405270723.33f51cc3@posting.google.com
Here's a script that'll do it:
#!/bin/sh
echo "81 ea 70 90 cd 05 8b 95 40 00" | awk '{
print "obase=2"
print "ibase=16"
for (i=NF; i > 0; i--) print toupper($i)
}' | bc | awk '{ printf "%.8d ", $1 }'
Any enhancements will be an exercise for the reader!
"nikki_wire" <nikki_wire@yahoo.com> wrote in message
news:60fdd9c9.0405270723.33f51cc3@posting.google.com...
> Hello!
>
> I am a UNIX novice but I'd like to write a script to decode some
> output - I was wondering if anyone could help me out with it?
>
> Here's what I'd like to do.
>
> I have some HEX output. eg. 81 ea 70 90 cd 05 8b 95 40 00
>
> I'd like to convert that to strict 8 bit binary with a zero as the
> filler for the extra characters but starting from the last 2 digits
> and working backwards.
> So for the above it would become 00 40 95 8b 05 cd 90 70 ea 81 and
> then subsequently 00000000 01000000 10010101 10001011 00000101
> 11001101 10010000 01110000 11101010 10000001 (I think that's right!)
>
> Does anyone have a way to do this? If so I'd appreciate it!
>
> Thanks
>
> Nikki
next prev parent reply other threads:[~2004-05-28 5:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-27 15:23 A little UNIX scripting challenge nikki_wire
2004-05-28 5:22 ` TyBreaker [this message]
2004-05-28 11:26 ` nikki_wire
2004-05-28 21:48 ` TyBreaker
2004-05-28 21:56 ` TyBreaker
2004-05-28 16:12 ` nikki_wire
2004-06-02 9:40 ` nikki_wire
2004-06-02 23:44 ` TyBreaker
2004-06-04 8:53 ` nikki_wire
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox