Re: Importing lines of variable length from ASCII

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Importing lines of variable length from ASCII
Date: 2010-02-26 05:51:27
Message-ID: 20100226055127.GA11413@a-kretschmer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

In response to Andrej :
> On 26 February 2010 00:52, A. Kretschmer
> <andreas(dot)kretschmer(at)schollglas(dot)com> wrote:
> > kretschmer(at)tux:~$ cat file.txt | awk '{cols=split($0,a,"|"); if (cols==4) print $0; else printf ("%s|\n",$0)}'
>
> Slightly shorter variant:
> awk -F'|' '{if(NF<4){print $0"|"}else{print $0}}' file.txt

Morning,

Hey, yeah, thx.

Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431 2EB0 389D 1DC2 3172 0C99

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Jasen Betts 2010-02-26 08:45:58 Re: Leap Years
Previous Message Tom Lane 2010-02-26 01:29:52 Re: How many columns can I have in an ORDER BY clause?