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

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

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

From: <Stephen.Lee_at_DTAG.Com>
Date: Tue, 16 Dec 2003 15:29:28 -0800
Message-ID: <F001.005DA1D1.20031216152928@fatcity.com>

OK. You got me going on this for a solution when GNU sed is not available.
(See what you did.)

Instead of the ksh example, here's a non-GNU sed one that works. It works on GNU sed too.

sed '

   $!N
   s/\(^.*\n.*:\)\(this\)\(.*$\)/\1that\3/    p
   d
'

Here's an awk that is essentially the equivalent of the ksh thing.

awk -F':| ' '

   BEGIN{ x = 1 }
   (x = 0||(x-1)) == 1 {$2 = "that"}
   {print $1":"$2,$3,$4,$5,$6,$7,$8,$9}
'

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: <Stephen.Lee_at_DTAG.Com
  INET: Stephen.Lee_at_DTAG.Com

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 Tue Dec 16 2003 - 17:29:28 CST

Original text of this message

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