pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Theo Galanakis <Theo.Galanakis@lonelyplanet.com.au>
To: pgsql-sql@postgresql.org
Subject: Re: Export tab delimited from mysql to postgres.
Date: Wed, 13 Oct 2004 09:56:01 +1000
Message-ID: <82E30406384FFB44AFD1012BAB230B5505F40D46@shiva.au.lpint.net> (raw)


Thankyou all for your advice,

Looking further into the issue I have realised that "data and formatting"
lines are denoted by the same CR/LF symbols. So if I where to replace all
CR/LF symbols it would create a file with one line... I have replace the
CR/LF for reading purposes below with \r\n or alternatively 0D 0A (hex):

columnA 		columnB
1               What a day!\r\n
2               What a week it has\r\n
been!\r\n
3               What the!\r\n

What this means that it is impossible to move line three back to line two to
look something like this:

columnA 		columnB
1               What a day!\r\n
2               What a week it has\rbeen!\r\n
3               What the!\r\n

I was thinking of writing code that checked each line to see if correct
number of tab delimited elements in this case 2 elements, if this was not
the case replace the \r\n with \r.

Theo


-----Original Message-----
From: Harald Fuchs [mailto:hf0722x@protecting.net]
Sent: Wednesday, 13 October 2004 1:38 AM
To: Theo Galanakis
Subject: Re: Export tab delimited from mysql to postgres.


>         Could you provide a example of how to do this?

Depends on what exactly your dump file contains.  Probably something like

  sed 's/\\\r/\\r/g'

This means: replace all carriage returns preceded by a backslash by '\r'.


______________________________________________________________________
This email, including attachments, is intended only for the addressee
and may be confidential, privileged and subject to copyright.  If you
have received this email in error, please advise the sender and delete
it.  If you are not the intended recipient of this email, you must not
use, copy or disclose its content to anyone.  You must not copy or
communicate to others content that is confidential or subject to
copyright, unless you have the consent of the content owner.=

view thread (9+ messages)

Message-ID: <82E30406384FFB44AFD1012BAB230B5505F40D46@shiva.au.lpint.net>
Permalink:  ../82E30406384FFB44AFD1012BAB230B5505F40D46@shiva.au.lpint.net/
Also on:    postgresql.org/message-id/82E30406384FFB44AFD1012BAB230B5505F40D46@shiva.au.lpint.net

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: Theo.Galanakis@lonelyplanet.com.au
  Subject: Re: Export tab delimited from mysql to postgres.
  In-Reply-To: <82E30406384FFB44AFD1012BAB230B5505F40D46@shiva.au.lpint.net>
  References: <82E30406384FFB44AFD1012BAB230B5505F40D46@shiva.au.lpint.net>

* 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