![]() |
![]() |
![]() |
||||
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 |
Damn Right I Kiss Ass!
Industry Role:
Join Date: Dec 2003
Location: Cowtown, USA
Posts: 32,409
|
(*)nix gurus - I need help with something...
What can I do on the command line to achieve this:
Code:
<? include("file"); ?> So say I have: domain.com/teens domain.com/latinas domain.com/lesbians And each directory (teens, latinas and lesbians) has a file called index.php in it and I want that include code to be added to the TOP of (prepended to) the file. Anyone know of some command line code or a bash script that can achive this? |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Join Date: Feb 2005
Location: Haarlem and Amsterdam, capital of the porn world ;-)
Posts: 6,496
|
Code:
for i in $(find ./ -name index.php); do cat $i |sed -e "s#<html>#<html><? include \(\"file\"\); ?>#" > $-new && mv $i-new $i;done i know it can be done with first line crap :P awk,sed,vi you name it :D too tired to think
__________________
Need adult hosting? Contact us! ![]() WARM Hosting Need an IT solution? or someone to check your site and security? Nossie - IT Professional |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Confirmed User
Join Date: Apr 2002
Location: /root/
Posts: 4,997
|
*not tested*
put your code in a file code.txt then: script.sh Code:
#!/bin/sh for i in `find . -name index.php`; do cat /path/to/code.txt $i > /tmp/newfile.tmp mv /tmp/newfile.tmp $i done BACKUP first ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
frc
Industry Role:
Join Date: Jul 2003
Location: Bitcoin wallet
Posts: 4,663
|
Don't forget: you can always run php on the command line too
![]()
__________________
Crazy fast VPS for $10 a month. Try with $20 free credit |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
Damn Right I Kiss Ass!
Industry Role:
Join Date: Dec 2003
Location: Cowtown, USA
Posts: 32,409
|
Darksouls appears to be correct.. will make a fake spot on the server and try it.
|
![]() |
![]() ![]() ![]() ![]() ![]() |