
On 08/21/2014 11:35 PM, Per Jessen wrote:
Lew Wolfgang wrote:
Hi Folks,
I've got a web site that's being "retired", so to speak, and will be replaced with a shiny new presentation. But I want to keep the old one on-line for historical reference at a different domainname. For example, the domain hosting the new content would be foobar.org, the one I want to keep for history would be foobar.info. So I need to go through the old html and substitute any references of foobar.org to foobar.info. There are 3705 separate lines in probably 1000 files in a large filesystem hierarchy containing the string that needs swapping. I'd rather not do it by hand!
What would you use? awk? A shell script? Something using grep and sed? Hi Lew
find and sed :
find <topdir> -type f -print0 | xargs -0 sed -i -e 's/foobar.org/foobar.info/g'
Not tested, don't try it without having a backup!
My thanks to Per, Dirk, Rolf, Greg, and Carlos for offering suggestions. I didn't need to capture the site data, I've got control of the source and it's backed up in multiple off-site locations. It's about 6-GB of content. This phrase will work well, I tested it on an off-line image. find . -name \*.html -print0 | xargs -0 sed -i -e 's/foo.org/foo.info/g' The site is used for reference purposes, and has a lot of non-html content which should preserve the old domain name for historical purposes in text files. I also ran it against .pl and .php files. In case you're wondering, this is a museum web site that contains lots of historic reference material. It was written in plain html by hand with vi over the course of 20-years. It is admittedly "old fashioned" and management wanted a new modern look. But none of the volunteers who contributed to the old site wanted to participate, so management hired out the work. Alas, they underestimated the magnitude of the task by an order of magnitude or so. The new site looks great, but is very shallow, and will be so for a long time. So I took the old content and registered a new name under .info and will keep that on-line until/if they ever get the data completely ported. This is also a volunteer effort on my part, it's not my day job. The old site does run on openSuSE on a dedicated server! They stuck the new site into the cloud somewhere and are tied in closely with Google, which also makes me nervous... Regards, Lew -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org