Re: Error on import

From: Medi Montaseri <medi(dot)montaseri(at)intransa(dot)com>
To: John <johnp(at)totcon(dot)com>
Cc: "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org
Subject: Re: Error on import
Date: 2002-10-25 05:16:36
Message-ID: 3DB8D3B4.9040406@intransa.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

here is even a smaller version of

perl -i -pe 's/\r\n/\n/' filename

which says...
-i do the modification in place
-p read and process every line/record of the file
-e run the following expressiion
's/\r\n/\n/' substitude '\r\n' with '\n'

Then create an alias like

alias dos2unix="perl -i -pe 's/\r\n/\n/' "

And then say

dos2unix myfile

And here is unix2dos
alias unix2dos="perl -i -pe 's/\n/\r\n/' "

Yes I know Solaris has dos2unix(1) and unix2dos(1), I'm just having a
little fun...
By the way these work on both Unix and NT environment, find a substitude
for aliases
on NT.

John wrote:

>Thanks Tom.. I had a buddy who works with perl give me a little help
>since I couldn't get vim to see the \r.. the following one liner got me
>where I needed to be. Thanks again.
>
>cat origfile|perl -e 'while (<>){$_ =~ s/\r//g;print $_;}' > prepfile
>
>-----Original Message-----
>I think you've got DOS-style newlines (\r\n) in your data file.
>Get rid of the carriage return characters (\r) and you'll be set.
>
> regards, tom lane
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Christian Traber 2002-10-25 05:36:47 Re: number of affected rows in pgtcl
Previous Message John 2002-10-25 03:38:42 Re: Error on import