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.

Post New Thread Reply

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 09-04-2006, 12:35 AM   #1
V_RocKs
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"); ?>
I wan't to insert that into each file called index.php in recursive directories.

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?
V_RocKs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-04-2006, 12:48 AM   #2
PussyTeenies
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
using the html as first line in the file

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
PussyTeenies is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-04-2006, 12:49 AM   #3
darksoul
Confirmed User
 
darksoul's Avatar
 
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
run the script in the main directory.

BACKUP first
__________________
1337 5y54|)m1n: 157717888
BM-2cUBw4B2fgiYAfjkE7JvWaJMiUXD96n9tN
Cambooth
darksoul is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-04-2006, 12:56 AM   #4
shake
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 Unless you have it installed as a DSO module in apache, but in that case you can install the stand-alone executable as well - what ever version you need.
__________________
Crazy fast VPS for $10 a month. Try with $20 free credit
shake is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-04-2006, 01:24 AM   #5
V_RocKs
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.
V_RocKs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks
Thread Tools



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.