![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Join Date: Mar 2004
Location: Australia iCQ:408018496
Posts: 1,332
|
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>
__________________
I dont need a sig. ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Join Date: Jan 2005
Posts: 105
|
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 ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Confirmed User
Join Date: Mar 2004
Location: Australia iCQ:408018496
Posts: 1,332
|
thanks a bunch darnoth!
__________________
I dont need a sig. ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Confirmed User
Join Date: Jan 2004
Location: Edmonton, Alberta
Posts: 75
|
Not quite darnoth.
![]() ![]() 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 ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
Confirmed User
Join Date: Mar 2004
Location: Australia iCQ:408018496
Posts: 1,332
|
INDK cheerS!
__________________
I dont need a sig. ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
Confirmed User
Join Date: Mar 2004
Location: Australia iCQ:408018496
Posts: 1,332
|
hmm neither seemed to work
the idea is to put in .sh file and run, right?
__________________
I dont need a sig. ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
Confirmed User
Join Date: Jan 2004
Location: Edmonton, Alberta
Posts: 75
|
No, just run it.
Describe the error. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 |
Confirmed User
Join Date: Mar 2004
Location: Australia iCQ:408018496
Posts: 1,332
|
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
__________________
I dont need a sig. ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
Confirmed User
Join Date: Mar 2004
Location: Australia iCQ:408018496
Posts: 1,332
|
ahh.. it seems to work now.. thx a heaps INDK!
__________________
I dont need a sig. ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 |
Confirmed User
Join Date: Mar 2004
Location: Australia iCQ:408018496
Posts: 1,332
|
INDK, thanks again.. if you could, hit me up on icq 7278746
cheers
__________________
I dont need a sig. ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |