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)
-   -   I need a Find & Replace perl script (https://gfy.com/showthread.php?t=251949)

Argoz 03-13-2004 06:46 PM

I need a Find & Replace perl script
 
I need to change all my ARS codes on my server.

Any suggestion for a good perl script to do the job?

grumpy 03-13-2004 06:46 PM

you can do it with php

SMG 03-13-2004 06:54 PM

I can code something like this in php real fast ...

Also, if you have dreamweaver, it has a find and replace tool on it that will work on whole directories ...

Rorschach 03-13-2004 06:55 PM

just use sed, much easier

Pun 03-13-2004 06:55 PM

You don't even need perl to do that, although it's certainly possible. I don't know exactly how your file structure is, so I don't know if this solution works for you, but it's how I'd do it.

----------------------
#!/bin/bash
for i in *
do
cat $i | sed 's/old_ars_code/new_ars_code/g' > .tmpabc123
mv .tmpabc123 $i
done
----------------------

That just goes through all files in a given directory and replaces "old_ars_code" with "new_ars_code".
Not perl, but it's probably just as fast (if not faster) and it's simple.

-Pun

Argoz 03-13-2004 08:58 PM

bump :)


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

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