![]() |
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> |
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 :). |
thanks a bunch darnoth!
|
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 :thumbsup |
INDK cheerS!
|
hmm neither seemed to work
the idea is to put in .sh file and run, right? |
No, just run it.
Describe the error. |
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 |
ahh.. it seems to work now.. thx a heaps INDK!
|
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