Page 1 of 1

Finding top and end of files

Posted: Mon Sep 09, 2002 10:35 pm
by Chris
Is there a regular expression to match the start and end of a file?
I'd like to wrap some html round a whole bunch of text files (find the start, replace with <head> etc., etc., ). This must be such a common situation - sure it could be done using Perl to loop through each file line by line but multifile search and replace in textpad would b eso muxch more convenient!

Re: Finding top and end of files

Posted: Tue Sep 10, 2002 8:07 pm
by Ed
Not exactly but...
Replace all
\n
with
¬
(assuming ¬ is used nowhere)
(now go and have a lunch break as it takes ages)
Replace all
^.*$
with
<head> & <tail>
(or whatever) - now at this point some of the files caused an error "recursion too deep, stack overflowed" - but still ended up with the right answer!
Replace all
¬
with
\n

Good luck!