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/Unix gurus... (https://gfy.com/showthread.php?t=454898)

EddiePulp 04-11-2005 11:22 PM

Linux/Unix gurus...
 
Yo,
Just wanting to know what command I could use to go through all sub directories and search THROUGH html files and replace </html> with <a href=.....</a></html>

darnoth 04-11-2005 11:29 PM

perl -pi -e '\s/old/new/' filemask .. so:
perl -pi -e '\s/<\/html>/<a href=http:\/\/www.yahoo.com\/search/' *
That only does the current directory, but you can do */*, then */*/* etc. You'll notice I put \'s in front of the /'s, thats because those are special characters, and you need to "escape" them by putting those there. You should put \'s in front of " characters as well if you use them in the href. I suggest creating a test file and testing it on that until you get it right :).

EddiePulp 04-11-2005 11:32 PM

thanks a bunch darnoth!

INDK 04-12-2005 12:12 AM

Not quite darnoth.

:warning USE AT YOUR OWN RISK :warning

First, make a backup of that directory. Then edit the obviously phony (capitalized) variables in this command to your liking:

Code:

find /PATH/TO/DIRECTORY/GOES/HERE/ -type f -name "*.html" | while read f; do perl -pe 's,\</html\>,<a href="LINKGOESHERE">HYPERTEXT</a></html>,' "$f" > "$f".new; mv "$f".new "$f"; done
...will recursively scan through /www/directory/goes/here and replace </html> with <a href="LINKGOESHERE">HYPERTEXT</A> in every single HTML file in that directory. Don't run this more than once.

:thumbsup

EddiePulp 04-12-2005 12:31 AM

INDK cheerS!

EddiePulp 04-12-2005 12:40 AM

hmm neither seemed to work

the idea is to put in .sh file and run, right?

INDK 04-12-2005 12:51 AM

No, just run it.

Describe the error.

EddiePulp 04-12-2005 12:53 AM

it seems to run.. no errors..but no resumes
does it matter if the </HTML> is </HTML> or </html> ?
and do I have to put \ in front of the " and <, >'s

EddiePulp 04-12-2005 12:58 AM

ahh.. it seems to work now.. thx a heaps INDK!

EddiePulp 04-12-2005 01:09 AM

INDK, thanks again.. if you could, hit me up on icq 7278746

cheers


All times are GMT -7. The time now is 06:27 AM.

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