D&C Lug - Home Page
Devon & Cornwall Linux Users' Group

[ Date Index ][ Thread Index ]
[ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [Fwd: Re: [LUG] Find & Replace across multiple files]



On Tue, 03 Dec 2002 11:55:22 +0000, Simon Waters wrote
Jonathan Melhuish wrote:

On Monday 02 December 2002  5:08 pm, you wrote:
If the files are all in one directory, use 'for file in *.html ...'

Viola!  It runs without errors with *.html - it just doesn't do 
anything!  I
fiddled with it a bit and now I seem to have the opposite problem - it 
seems
to match on almost everything!

At the risk of repeating myself the sed FAQ did tell you how to
do it in PERL ;-)

Ooh, *far* too much like effort, all this reading malarkey ;-)  It's true 
though, I love reading through technical docs when I'm just pottering around 
(no, really, I do, even if it is pretty sad), but when I'm in a hurry I'd 
much rather just click a few buttons or something...

SED matches the longest match, which is probably your current
problem, assuming you have several tags per line.

Hmm, there's usually multiple lines per tag rather than the other way around, 
if that makes sense.  Maybe that's causing problems?  The sections look a bit 
like this:

[control-set]
options=blah
[/control-set]

I'm gonna go through them manually if nobody tells me how to make it work, 
it's easier for my little brain... (although somewhat more boring)

PERL entended regular expressions will match the shortest length
with a "?" after the "*", I think sed may do this in some
versions or will do eventually or some such.

<looks up and sees words flying over his head>

Why are regular expressions so hard to use if you don't use them
every day? My brain never retains more than the basics.

Here here... I'm sure they're *really* powerful if you learn how to use them, 
but I really haven't got time at the mo.  Point-and-click regex builder, 
anyone?

Jon

--
The Mailing List for the Devon & Cornwall LUG
Mail majordomo@xxxxxxxxxxxx with "unsubscribe list" in the
message body to unsubscribe.


Lynx friendly