I went into production with the script below where. The benchmark on this
I thought was impressive, so I thought to share it:

The fld "findChunk" has the grep string:

(?s)<div id="container">(.*?)<div id="intro">

the fileList has a list of paths already chosen for files to be operated on.
in this case 647  files.

Intel mac running the rev app over   100 baseT opening files
on an OSX intel server over the LAN.

Ok so I thought to myself "Hmmm replaceText... this is going to be slow...
If I do this in BBEdit, on a multi-file search and replace, I would go for tea...
let's see how Rev does on this new platform."

open, replaceText, save and close

647 interations, 22 seconds!

I had 3 other unique replacements to make on those files,
Job done in 1 min 20 seconds.

The longest part of the operation was running a script to
use FTP to upload all those to the web server... of course
that ran in the background.

next production job will be a complete update of the web design
at www.hinduismtoday.com  where the same operation
will be done on 3287 files...
-------

on mouseUp

## Warnings!
answer "This is very dangerous! If you are unsure of yourself, stop now! do the S n R on a single file and check your work!" with "OK" or "Cancel"
  if it is  "Cancel" then exit to top
  put empty into fld "pau"
if (the hilight of btn "Use Result List" = "false") then put empty into fld "resultList"
  answer "Are you sure? This operation is irreversible."&cr&\
"If you are nervous be sure to have a back up!" with "Yes, just do it!" or "No"
  if it is "No" then exit MouseUp
  set the cursor to busy

## Get find and replace strings

  put fld "findChunk" into tSearchString
  put fld "replaceChunk" into tReplaceString

## get paths to files

if the hilight  of btn "Use Result List" then
    put fld "resultList" into tFileList
  else
    put fld "fileList" into tFileList
  end if

## Read, do SnR, save

 repeat for each line y in tFileList
    put url ("file:"&y) into theFileData


  if the hilite of btn "Use Grep" then
     put fld "replaceChunk" into tReplaceString
      put fld "findChunk" into tFindString
put replaceText(theFileData,tFindString,tReplaceString) into theFiledata
  else
    replace tSearchString with tReplaceString in theFileData
  end if

    put theFileData into  url ("file:"&y)

  end repeat
  put "Pau!" into fld "Pau"

end mouseUp



Ken Ray wrote:
does it... and I found the section in the BBEdit help on
"Perl-Style Pattern Extensions"  where all this is
explained...

"s       allow. to match \r"

Marvelous!  The unintuitive part is that this pattern
or "toggle" must begin the entire expression.

For more on how Rev handles it, go to www.pcre.org/man.txt, which is the documentation on the PCRE library that Rev uses for regex handling.


--
Om shanti
(In  Peace)

Sivakatirswami
www.himalayanacademy.com

Get Hinduism Today Digital Edition. It's Free!
http://www.hinduismtoday.com/digital/
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to