Re: Postgresql and scripting

Поиск
Список
Период
Сортировка
От Jerome Lyles
Тема Re: Postgresql and scripting
Дата
Msg-id 200409080038.04215.susemail@hawaii.rr.com
обсуждение исходный текст
Ответ на Postgresql and scripting  (Jerome Lyles <susemail@hawaii.rr.com>)
Ответы Re: Postgresql and scripting  (Greg Stark <gsstark@mit.edu>)
Список 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 по дате отправления:

Предыдущее
От: Jerome Lyles
Дата:
Сообщение: Postgresql and scripting
Следующее
От: Phil Endecott
Дата:
Сообщение: Function caches wrong OID of temporary table?