Home Messages Index
[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index

Re: OT: Hey guys, I need, like, programmy advice...

  • Subject: Re: OT: Hey guys, I need, like, programmy advice...
  • From: Roy Schestowitz <newsgroups@xxxxxxxxxxxxxxx>
  • Date: Fri, 21 Oct 2005 04:53:47 +0100
  • Newsgroups: alt.internet.search-engines
  • Organization: schestowitz.com / MCC / Manchester University
  • References: <ncnfl1ltkko11pqmv0s8u8ep8iinffdfpn@4ax.com> <pan.2005.10.20.18.49.34.64663@1.invalid> <3rq8bkFl1dbnU1@individual.net> <09lgl1ddcn1pkjs34fn0thn3hislmrv77i@4ax.com>
  • Reply-to: newsgroups@xxxxxxxxxxxxxxx
  • User-agent: KNode/0.7.2
__/ [John A.] on Friday 21 October 2005 03:44 \__

> On Thu, 20 Oct 2005 20:09:40 +0100, Brian Wakem <no@xxxxxxxxx> wrote:
> 
>>wd wrote:
>>
>>> This is a little script that I use a lot, just changing one or two lines
>>> depending on the task I need done.  I'm just a beginner so there might be
>>> much better ways to do it, but this works for ampersands, and will also
>>> work for your other example with a simple change.
>>
>>
>>A one-liner will do the job:
>>
>>perl -p -i -e 's!&!&amp;!g' filename
>>
>>or
>>
>>perl -p -i -e 's!&!&amp;!g' *.html
>>
>>to change in all html files in the current directory.
> 
> Would that also change all instances of "&amp;" in all the html files
> in the directory to "&amp;amp;"?
> 
> (And "&nbsp;" to "&amp;nbsp;", etc...)

Only if you run it more than once.

It is not recursive (tail recursion where the head expands) unless you re-
quest for it to behave that way. That's a very good observation, which of-
ten justifies keeping a copy before applying any batch-mode changes. It is
otherwise  quite irreverisble, unless you are willing to script  something
just to make up for a foolish mistake. Been there, seen that. *smile*

Roy

-- 
Roy S. Schestowitz      |    "On the eighth day, God created UNIX"
http://Schestowitz.com  |    SuSE Linux    |     PGP-Key: 74572E8E
  4:50am  up 56 days 17:04,  6 users,  load average: 0.15, 0.42, 0.68
      http://iuron.com - next generation of search paradigms

[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index