[OT] Replace chunk of HTML on webserver
![](https://seccdn.libravatar.org/avatar/d8f80b5863f8017700865ee38b69d4c0.jpg?s=120&d=mm&r=g)
Does anyone know of a script or something that will replace about 20 lines of HTML in about 100 files on a remote Unix webserver? Most of the scripts I have seen do phrases or words, but not a big chunk like this. Thanks Kevin
![](https://seccdn.libravatar.org/avatar/97aba6f631465fe6824717869f3a6943.jpg?s=120&d=mm&r=g)
On Sunday 20 May 2001 19:23, Kevin Donnelly wrote:
Does anyone know of a script or something that will replace about 20 lines of HTML in about 100 files on a remote Unix webserver? Most of the scripts I have seen do phrases or words, but not a big chunk like this.
Thanks Kevin
If the 20 lines you want to change is *exactly* identical in all files (same text, same place in file) this has worked for me: - Get one of the files from the website 'oldfile' - Make changes and save it as 'newfile' - Create an ed(1) script with diff(1): diff -e oldfile newfile >edscript - Edit 'edscript' and add a 'w' on last line to write the file - MAKE A BACKUP OF EXISTING FILES JUST IN CASE - Run ed on all the files you want to change for f in some-pattern do cat edscript | ed $f done -- Groete | Greetings | Grüßen | Salutations Piet le Roux
![](https://seccdn.libravatar.org/avatar/7161c31f2f0bc6dd8bad782a82ba1a26.jpg?s=120&d=mm&r=g)
Or use PERL to find the files, and replace/insert/whatever text you need. Sorry to say i am NOT familliar with perl. But i have heard/seen it done... -- /Rikard -----***-----***-----***-----***-----***-----***-----***-----***-----***-----***----- Rikard Johnels Phone: +46 (070) 464 99 39 Computer Consultant Email: rjhn@linux.nu -----***-----***-----***-----***-----***-----***-----***-----***-----***-----***-----
participants (3)
-
Kevin Donnelly
-
Piet le Roux
-
Rikard DustPuppy Johnels