Re: Postgresql and scripting - Mailing list pgsql-general

From Jerome Lyles
Subject Re: Postgresql and scripting
Date
Msg-id 200409080038.04215.susemail@hawaii.rr.com
Whole thread Raw
In response to Postgresql and scripting  (Jerome Lyles <susemail@hawaii.rr.com>)
Responses Re: Postgresql and scripting
List pgsql-general
On Tuesday 07 September 2004 10:22 pm, Dorward villaruz wrote:
> hi!
>
> try this in commandline i assume you save the file in sams.txt
> final file will be sams2.txt
>
> cat sams.txt | sed -e 's/  /@@/g' -e 's/ //g' -e 's/@@/ /g' > sams2.txt
>
> or put this in a script say convert.sh
>
> script start:
> #!/bin/bash
> cat $1 | sed -e 's/  /@@/g' -e 's/ //g' -e 's/@@/ /g' > $2
> script end:
>
> how to use?
>
> convert.sh <input file>  <output file>
>
> best regards,
> wardy
>
Thank you for this.  I've spent a few hours today searching and experimenting
to produce this code.  I can almost understand the sed command.  Everything
between the quotes is the action to be taken.  The 's' is for substitution,
the / / is the whitespace to be replaced, the/@@/ is what the whitespace is
replaced with but I don't know what the @@ stands for, the g means it's
applied globally.  I think what I just said is wrong because I have no clue
why the second and third substitution are there.  And finally the output is
directed to $2.  I'll have to wait until tomorrow evening to play with it.  I
look forward to it.
thanks,
Jerome

pgsql-general by date:

Previous
From: Jerome Lyles
Date:
Subject: Postgresql and scripting
Next
From: Phil Endecott
Date:
Subject: Function caches wrong OID of temporary table?