pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christopher Sawtell <csawtell@xtra.co.nz>
To: Josh Berkus <josh@agliodbs.com>
To: pgsql-sql@postgresql.org
Subject: Re: Need help with search-and-replace
Date: Sun, 6 May 2001 22:22:40 +1200
Message-ID: <01050622224000.30303@berty> (raw)
In-Reply-To: <web-52032@davinci.ethosmedia.com>
References: <web-52032@davinci.ethosmedia.com>

On Sunday 06 May 2001 10:27, Josh Berkus wrote:
> Folks,
>
> 	I need to strip certain columns out of my pgdump file.  However, I
> can't figure out how to use any Unix-based tool to search-and-replace a
> specific value which includes a tab character (e.g. replace "{TAB}7
> 00:00:00" with "" to eliminate the column).

In other words you wish to remove one field from a tab delimited file?

> 	RIght now, I'm copying the file to a Win32 machine and using MS Word
> for the search-and-replace,

Oh no!  MS is bound to screw it up somehow.

> but I'm sure there's got to be a better way
> ... *without* learning VI or Emacs.  Help

man cut  is your friend.
info cut  is another friend if you are on a GNU system.

cat the.file | cut  -f1,3-   # assuming is the field you wish to remove is 
the second one.

cut uses the tab character as the delimiter by default.

single line file attached

-- 
Sincerely etc.,

 NAME       Christopher Sawtell
 CELL PHONE 021 257 4451
 ICQ UIN    45863470
 EMAIL      csawtell @ xtra . co . nz
 CNOTES     ftp://ftp.funet.fi/pub/languages/C/tutorials/sawtell_C.tar.gz

 -->> Please refrain from using HTML or WORD attachments in e-mails to me <<--

Attachments:

the.file (text/plain, 48B) download The first text field 700:00:00:00 the next field

view thread (4+ messages)  latest in thread

Message-ID: <01050622224000.30303@berty>
Permalink:  ../01050622224000.30303@berty/
Also on:    postgresql.org/message-id/01050622224000.30303@berty

 · 

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: csawtell@xtra.co.nz, josh@agliodbs.com
  Subject: Re: Need help with search-and-replace
  In-Reply-To: <01050622224000.30303@berty>
  References: <web-52032@davinci.ethosmedia.com> <01050622224000.30303@berty>

* 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