Re: Need help with search-and-replace - Mailing list pgsql-sql

From Christopher Sawtell
Subject Re: Need help with search-and-replace
Date
Msg-id 01050622224000.30303@berty
Whole thread Raw
In response to Need help with search-and-replace  ("Josh Berkus" <josh@agliodbs.com>)
List 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 SawtellCELL PHONE 021 257 4451ICQ UIN    45863470EMAIL      csawtell @ xtra . co . nzCNOTES
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 <<--


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: Dateadd
Next
From: "guard"
Date:
Subject: update error