Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> OffTopic : sed : Alternate (2,4,6..) replacement

OffTopic : sed : Alternate (2,4,6..) replacement

From: GovindanK <gkatteri_at_fastmail.fm>
Date: Mon, 15 Dec 2003 15:24:27 -0800
Message-ID: <F001.005D9F9D.20031215152427@fatcity.com>


Hi List
I need some help on this;
How do i replace the 2nd,4th,6th occurances of a column (vertical) in a file.
I know sed does it within a row

$ cat swt

01:this is a file1 this
02:this is a file1 this
03:this is line3 
04:this is line4

$ sed 's/this/that/2' swt

01:this is a file1 that
02:this is a file1 that
03:this is line3 
04:this is line4

$ sed 's/this/that/1' swt
01:that is a file1 this
02:that is a file1 this
03:that is line3 
04:that is line4

But i want

01:this is a file1 this
02:that is a file1 this
03:this is line3 
04:that is line4

I tried awk but awk seems to be going one line at a time.

Thanks in Advance.

GovindanK

-- 
http://www.fastmail.fm - The professional email service
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: GovindanK
  INET: gkatteri_at_fastmail.fm

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Mon Dec 15 2003 - 17:24:27 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US