pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Steve Martin <steve.martin@nec.co.nz>
To: Carol Walter <walterc@indiana.edu>
Cc: Plugge, Joe R. <JRPlugge@west.com>
Cc: Steve Crawford <scrawford@pinpointresearch.com>
Cc: Scott Marlowe <scott.marlowe@gmail.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Hex representation
Date: Fri, 26 Sep 2008 12:43:23 +1200
Message-ID: <48DC302B.7000100@nec.co.nz> (raw)
References: <337D9AE2-2BEF-48E3-8DF4-E7F0CA560A1B@indiana.edu>
	<dcc563d10809241243t20c14dbcl65089e12d54de44@mail.gmail.com>
	<48DBCD2B.6020108@pinpointresearch.com>
	<B69C54C5-4A69-493B-ACA2-E9F3D3E5DC19@indiana.edu>
	<32CC45C5BDC57241B9BCEF37AC0C5DB5080B9A0E@OMAEXMB02.corp.westworlds.com>

Hi, - see below

Plugge, Joe R. wrote:

>Change the shbang line to match where your php in installed (if it is at
>all)
>
>#!/full_path_to_my_php -q
>
>-----Original Message-----
>From: pgsql-admin-owner@postgresql.org
>[mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Carol Walter
>Sent: Thursday, September 25, 2008 1:15 PM
>To: Steve Crawford
>Cc: Scott Marlowe; pgsql-admin@postgresql.org
>Subject: Re: [ADMIN] Hex representation
>
>Well, it was a bit convoluted, but I created the file with Excel,  
>filling the right number of cells with \x55.  This worked too.  The  
>script wouldn't run for me.  I got an error about a "bad interpreter".
>
>Carol
>
>On Sep 25, 2008, at 1:40 PM, Steve Crawford wrote:
>
>  
>
>>Scott Marlowe wrote:
>>    
>>
>>>I used this very simple little php script to make this
>>>
>>>filename: mk55:
>>>#!/usr/bin/php -q
>>><?php
>>>for ($i=0;$i<262144;$i++){
>>>    print chr(85);
>>>}
>>>?>
>>>
>>>      
>>>
>>Or, using standard *nix tools (Note: 0x55 = ascii U):
>>dd bs=1k count=256 if=/dev/zero | tr '\000' U  > full_of_0x55
>>
>>Cheers,
>>Steve
>>
>>    
>>
I liked Steve Crawford's idea, a good one liner but I could not get it 
to work on sunos, version (Generic_118558-35).  Worked on HPUX.

Just using basic shell scripting, the following are another way of doing it.

Using bash, it can be done like this:
--- Start u.sh ---
#!/usr/local/bin/bash  <- change to output of "which bash"
max=`expr 256 \* 1024`
for (( i=0; i<$max; ++i )) ; do
  echo -n U   <- depends on system, try print
done
--- End u.sh ---
E.g
./u.sh > losOfUs.txt
% xd losOfUs.txt | less
0000000 5555 5555 5555 5555 5555 5555 5555 5555
*
0040000

Or ksh or sh
--- Start u.sh ---
#!/bin/ksh  <- change to output of "which ksh"
max=`expr 256 \* 1024`
i=0
while [ $i -lt $max ] ; do
  print -n U
  i=`expr $i + 1`
done
--- End u.sh ---
./u.sh > losOfUs.txt
od -x losOfUs.txt | less
0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
0003720  <- still working, slow machine :-{

Regards
Steve Martin





view thread (10+ messages)  latest in thread

Message-ID: <48DC302B.7000100@nec.co.nz>
Permalink:  ../48DC302B.7000100@nec.co.nz/
Also on:    postgresql.org/message-id/48DC302B.7000100@nec.co.nz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: steve.martin@nec.co.nz, walterc@indiana.edu, JRPlugge@west.com, scrawford@pinpointresearch.com, scott.marlowe@gmail.com
  Subject: Re: Hex representation
  In-Reply-To: <48DC302B.7000100@nec.co.nz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox