GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Linux GURUS pls help - mass replace (https://gfy.com/showthread.php?t=566997)

Gasper 01-23-2006 04:14 AM

Linux GURUS pls help - mass replace
 
I have a problem.

I'd like to replace an URL in several .html files in several directories.

The structure is like this:
/dir
/dir1/
html1.html
html2.html
html3.html
/dir2/
somehtml1.html
somehtml2.html
somehtml3.html
.....

I would like to replace an URL with another one in all files and in all directories (dir1, dir2, dir3...). Is this doable?

Please help

PussyTeenies 01-23-2006 04:22 AM

assuming xxx.html is to be replaced by yyy.html

for i in $(ls -1 *);do sed 's/xxx.html/yyy.html/g' $i ; done

for i in $(ls -1 */*);do sed 's/xxx.html/yyy.html/g' $i; done

munki 01-23-2006 04:23 AM

Or dump the files to a non Linux and run a typical find and replace from Dreamweaver of the like.

3M TA3 01-23-2006 04:26 AM

Quote:

Originally Posted by MikyMunki
Or dump the files to a non Linux and run a typical find and replace from Dreamweaver of the like.

yeah, works for me.

PussyTeenies 01-23-2006 06:52 AM

bah wintendo :)

MickeyG 01-23-2006 07:19 AM

rpl is a UN*X text replacement utility. It will replace strings with new strings in multiple text files. It can scan directories recursively and replace strings in all files found. It includes source, a build script, and a man page, and should work on most flavors of UN*X. Linux Intel, LinuxPPC, and Source RPMS are available on the website, as are binaries for other OSes.

Homepage http://www.laffeycomputer.com/software.html
Download ftp://ftp2.laffeycomputer.com/pub/cu...pl-beta.tar.gz


All times are GMT -7. The time now is 11:17 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123