Re: Need help with search-and-replace

From: Christopher Sawtell <csawtell(at)xtra(dot)co(dot)nz>
To: "Josh Berkus" <josh(at)agliodbs(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Need help with search-and-replace
Date: 2001-05-06 10:22:40
Message-ID: 01050622224000.30303@berty
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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 <<--

Attachment Content-Type Size
the.file text/plain 50 bytes

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message guard 2001-05-06 14:43:15 update error
Previous Message Tom Lane 2001-05-06 05:00:17 Re: Dateadd