Re: Need help with search-and-replace

Christopher Sawtell <csawtell@xtra.co.nz>

From: Christopher Sawtell <csawtell@xtra.co.nz>
To: "Josh Berkus" <josh@agliodbs.com>, pgsql-sql@postgresql.org
Date: 2001-05-06T10:22:40Z
Lists: pgsql-sql

Attachments

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