Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id E85EA632E32 for ; Mon, 31 May 2010 22:39:14 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 13812-04 for ; Tue, 1 Jun 2010 01:39:05 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.egcrc.net (mail.egcrc.net [63.193.204.10]) by mail.postgresql.org (Postfix) with ESMTP id E3A3863283A for ; Mon, 31 May 2010 22:39:06 -0300 (ADT) Received: from EGCRC-EX04.egcrc.org ([::1]) by EGCRC-EX03.egcrc.org ([fe80::5c82:4343:5244:a0d5%11]) with mapi; Mon, 31 May 2010 18:39:03 -0700 From: Tena Sakai To: Gabriele Bartolini CC: "pgsql-admin@postgresql.org" Date: Mon, 31 May 2010 18:36:41 -0700 Subject: Re: What is field separator? Thread-Topic: [ADMIN] What is field separator? Thread-Index: Acr/00+oD/H6TS7ZQuiH+UhXrxRPXABV5LTz Message-ID: In-Reply-To: <4C0223B8.6050009@2ndQuadrant.it> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-Entourage/13.4.0.100208 acceptlanguage: en-US Content-Type: multipart/alternative; boundary="_000_C829B239AF3Btsakaigalloucsfedu_" MIME-Version: 1.0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=-10 required=5 tests=BAYES_20=-0.001, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 201005/305 X-Sequence-Number: 34778 --_000_C829B239AF3Btsakaigalloucsfedu_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Hi Gabriele, This isn=92t strictly a psql problem, but please humor me. I can do below from linux prompt: $ echo "select marker, p, afreq from gallo.fbat_sdsdecode limit 10" | \ > psql -P 'format=3Dunaligned' -P 'fieldsep=3D,' -t -f - musket And get: RS3094315,0.578121,0.735 RS3094315,0.578121,0.265 RS3115850,0.365978,0.251 RS3115850,0.365978,0.749 RS12562034,,0.135 RS12562034,,0.865 RS4475691,0.247133,0.710 RS4475691,0.247133,0.290 RS28705211,,0.725 RS28705211,,0.275 But when I do this: $ echo "select marker, p, afreq from gallo.fbat_sdsdecode limit 10" | \ > psql -P 'format=3Dunaligned' -P 'fieldsep=3D\t' -t -f - musket (here the only change from the previous is the specification of fieldsep) Then I get: RS3094315\t0.578121\t0.735 RS3094315\t0.578121\t0.265 RS3115850\t0.365978\t0.251 RS3115850\t0.365978\t0.749 RS12562034\t\t0.135 RS12562034\t\t0.865 RS4475691\t0.247133\t0.710 RS4475691\t0.247133\t0.290 RS28705211\t\t0.725 RS28705211\t\t0.275 What's denoted as \t is not a tab character. It is a two character sequence backslash followd by a t. I have tried all other possibilities such as \\t , "\t", etc that I can think of, but I cannot get an honest to god tab character to appear as field separator. I can do it from psql and achieve what I want, but I need to do this from shell level. Any suggestion what else I can try? Regards, Tena Sakai tsakai@gallo.ucsf.edu On 5/30/10 1:37 AM, "Gabriele Bartolini" wrote: > Tena Sakai ha scritto: >> Can somebody please tell me what =93|=94 is called in my example above? >> And is it possible to change it from =93|=94 to something else for >> display purpose? > The field separatore in psql is used only when the format is "unaligned" > (which does not happen to be default). > > In order for it to be effective, you need to type in psql: > > \pset format unaligned > \pset fieldsep '\t' > > This will give you an output with columns that are separated by tab. > > However, I suggest that you look at the documentation for more options > and ways to achive the same results: > http://www.postgresql.org/docs/current/static/app-psql.html > > Cheers, > Gabriele --_000_C829B239AF3Btsakaigalloucsfedu_ Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Re: [ADMIN] What is field separator? Hi Gabriele,

This isn=92t strictly a psql problem, but please humor me.

I can do below from linux prompt:
  $ echo "select marker, p, afreq from gallo.fbat_sdsdecode = limit 10" | \
 > psql -P 'format=3Dunaligned' -P = 'fieldsep=3D,' -t -f - musket    &nb= sp;  
And get:
  RS3094315,0.578121,0.735
  RS3094315,0.578121,0.265
  RS3115850,0.365978,0.251
  RS3115850,0.365978,0.749
  RS12562034,,0.135
  RS12562034,,0.865
  RS4475691,0.247133,0.710
  RS4475691,0.247133,0.290
  RS28705211,,0.725
  RS28705211,,0.275

But when I do this:
  $ echo "select marker, p, afreq from gallo.fbat_sdsdecode = limit 10" | \
 > psql -P 'format=3Dunaligned' -P = 'fieldsep=3D\t' -t -f - musket
(here the only change from the previous is the specification of fieldsep) Then I get:
  RS3094315\t0.578121\t0.735
  RS3094315\t0.578121\t0.265
  RS3115850\t0.365978\t0.251
  RS3115850\t0.365978\t0.749
  RS12562034\t\t0.135
  RS12562034\t\t0.865
  RS4475691\t0.247133\t0.710
  RS4475691\t0.247133\t0.290
  RS28705211\t\t0.725
  RS28705211\t\t0.275

What's denoted as \t is not a tab character.  It is a two character sequence backslash followd by a t.  I have tried all other possibiliti= es
such as \\t , "\t", etc that I can think of, but I cannot get an = honest to
god tab character to appear as field separator.  I can do it from psql=
and achieve what I want, but I need to do this from shell level.  Any<= br> suggestion what else I can try?

Regards,

Tena Sakai
tsakai@gallo.ucsf.edu

On 5/30/10 1:37 AM, "Gabriele Bartolini" <gabriele.bartolini@2ndQuadrant.it> wrote:<= br>
> Tena Sakai ha scritto:
>> Can somebody please tell me what = =93|=94 is called in my example above?
>> And is it possible to change it from =93|=94 to something else for=
>> display purpose?
> The field separatore in psql is used on= ly when the format is "unaligned"
> (which does not happen to be default).
>
> In order for it to be effective, you need to type in psql:
>
> \pset format unaligned
> \pset fieldsep '\t'
>
> This will give you an output with columns that are separated by tab. >
> However, I suggest that you look at the documentation for more options=
> and ways to achive the same results:
> http://www.postgresql.org/docs/current/static/app-psql.html
>
> Cheers,
> Gabriele
--_000_C829B239AF3Btsakaigalloucsfedu_--