[CS-FSLUG] Sed and other tools

Tim Young Tim.Young at LightSys.org
Fri Jul 8 07:15:58 CDT 2011

I did not try Robert's perl script, but I will say that Perl has the 
ability to match across lines while sed does not.   In Sed, you need 
to use hold-spaces and other complex things to get the job done.  In 
Perl, you put the "m" (or "s", which is similar) at the end of the 
pattern replacement string and it will do the search/replace across 
newlines.  So, in this case, I would say that using Perl is the way 
to go.

     - Tim Young

On 7/7/2011 9:10 PM, Ed Hurst wrote:
> I assume sed is not necessarily the proper tool for this task, or
> perhaps not the whole task. After re-reading the most recent 
> discussion
> on sed, I was hoping to accomplish something a bit more complicated 
> for
> a similar context.
> On my site, I typically include on each page a header meta line which
> identifies who produced the file. I chose the term "formator" 
> because I
> don't own the content of all the files, but I do have permission to 
> use
> it. At any rate, it prevents spamming while permitting some folks to
> contact me. Each of these has a deconstructed email address which 
> is no
> longer valid "somebody at such dot com". The problem with using sed is
> the lines are broken, so that the input pattern has a newline break in
> it:
> <meta name="formator" content="Ed Hurst - softedges at softhome dot
>   net" />
> That's a literal paste. It's not necessary to keep the line break, 
> but I
> need to replace the whole address with 'eddie at soulkiln dot org'. I
> estimate there are over a hundred files in the archive in several
> different directories and subdirectories. Not all of them have this 
> old
> address; some have yet another invalid address.
> After reading the manpage and some tutorials, I don't quite get how to
> persuade sed to read past the newline. The examples I've found are all
> far more complex than I need. I may someday learn those things, but
> right now is not the best time to take an extended course in sed.
> Ed Hurst
> --------
> Open for Business - http://ofb.biz/
> Kiln of the Soul - http://soulkiln.org/
> blog - http://soulkiln.myopera.com/
> _______________________________________________
> ChristianSource FSLUG mailing list
> Christiansource at ofb.biz
> http://cs.uninetsolutions.com

More information about the Christiansource mailing list