Article View: alt.comp.lang.shell.unix.bourne-bash
Article #2Re: how to replace multiple lines in a file?
From: Derk Gwen
Date: Tue, 10 Jun 2003 05:35
Date: Tue, 10 Jun 2003 05:35
20 lines
1915 bytes
1915 bytes
# Essentially, I'm just wondering if anybody has a solution to this using
# basic unix utilities (bash, sed, awk, etc). I'd rather not write a C
# program to do something that'd probably easier done otherwise.
Tcl is widely available and its regexp spans multiple lines unless you
specifically tell it not to.
set f [open file-path r]
set buffer [read $f]
close $f
regsub -all {\[html\]\n<pre>} $buffer {[code]} buffer
set f [open file-path w]
puts $f $buffer
close $f
--
Derk Gwen http://derkgwen.250free.com/html/index.html
So....that would make Bethany part black?
Technical Details
Message-ID:
<vearg9n0d7clff@corp.supernews.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-post-01!supernews.com!corp.supernews.com!not-for-mailReferences:
<9McFa.1192$PD3.13019@nnrp1.uunet.ca>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 114230,bc0476873b7ef6e X-Google-Attributes: gid114230,public X-Google-Thread: faa64,bc0476873b7ef6e X-Google-Attributes: gidfaa64,public X-Google-Thread: f8c9b,bc0476873b7ef6e X-Google-Attributes: gidf8c9b,public X-Google-Thread: fc89c,bc0476873b7ef6e X-Google-Attributes: gidfc89c,public X-Google-Thread: 1012a6,bc0476873b7ef6e X-Google-Attributes: gid1012a6,public X-Google-Thread: fee36,bc0476873b7ef6e X-Google-Attributes: gidfee36,public X-Google-Thread: 10f717,bc0476873b7ef6e X-Google-Attributes: gid10f717,public X-Google-Thread: 10183f,bc0476873b7ef6e X-Google-Attributes: gid10183f,public X-Google-ArrivalTime: 2003-06-09 22:35:06 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: Derk Gwen <derkgwen@HotPOP.com> Newsgroups: alt.comp.lang.shell.unix.bourne-bash,alt.os.linux,alt.unix.geeks,ca.unix,comp.unix,comp.unix.programmer,comp.unix.questions,comp.unix.shell Subject: Re: how to replace multiple lines in a file? Date: Tue, 10 Jun 2003 05:35:05 -0000 Organization: Quick STOP Groceries Message-ID: <vearg9n0d7clff@corp.supernews.com> References: <9McFa.1192$PD3.13019@nnrp1.uunet.ca> X-Complaints-To: abuse@supernews.com Lines: 20