Skip site navigation (1) Skip section navigation (2)

Re: [GENERAL] Desperately Seeking Regular Expression

From: Herouth Maoz <herouth(at)oumail(dot)openu(dot)ac(dot)il>
To: Thomas Good <tomg(at)q8(dot)nrnet(dot)org>
Cc: pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] Desperately Seeking Regular Expression
Date: 1999-04-29 11:34:39
Message-ID: l03130304b34df32263e4@[147.233.159.109] (view raw or whole thread)
Thread:
Lists: pgsql-general
At 16:35 +0300 on 27/04/1999, Thomas Good wrote:


>
> I've had success previously doing a port - but from FoxPro which
> allows one to dump data delimited by tabs.  Unfortunately, PROGRESS
> dumps fields delimited by whitespace rather than tabs and I can find no
> documentation on how to alter this behaviour.
>
> I read the recent post wherein someone used awk to change whitespace
> to tabs:
>
> cat $input | awk '{ print $1"\t"$2"\t"$3"\t"$4"\t"$5"\t" \
> $6"\t"$7"\t" }' > $input.out
>
> I am using this with good effect.  However, I run into trouble as
> inside my dump file(s) there are doublequoted character strings.
> awk is changing the whitespace delimited words inside the char strs
> into tab delimited words inside strings.  Ouch.

I have a feeling that you are missing additional points. For example, if
you want to use the resulting text as input for COPY, strings should not be
delimited within quotes. And possible tabs and newlines and backslashes
within the file should be properly preceded with "\".

And what do you mean by the fact that the output is delimited by
whitespaces? That there is a single whitespace between the fields? Because
I think the awk above would join null fields in such a case. Or did you
mean that it outputs a fixed width file? That is, that the first field is
from column 1 to column 20, and if it's shorter, it adds spaces until
column 20?

That would require a different treatment.

If you give a more detailed description, you may get a better solution.

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma



In response to

pgsql-general by date

Next:From: Herouth MaozDate: 1999-04-29 11:42:18
Subject: Re: [HACKERS] Re: [GENERAL] unknown symbol 'lo_unlink'
Previous:From: Chris BitmeadDate: 1999-04-29 04:28:42
Subject: Re: [GENERAL] LIMIT QUESTION

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group