need a php script to format and display a select amount of text from a file
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
need a php script to format and display a select amount of text from a file
hey i need a php script to format and display a select amount of text from a file or a cron job that'll do it (with grep etc) and out put to a file but whatever is easier
i want to display all the banned ip's i have in my .htaccess file
i have a lot of lines in my .htaccess file but i have a line that read like this:
the 3 test ip's are 123.123.123.123 and i want the "\" stripping and the "|" removing and each ip to be on it's own line like this:
123.123.123.123
123.123.123.123
123.123.123.123
i'm not bothered if this is a php script that'll read the .htaccess file and display the output or a cron job that'll run every x mins and output it to a .txt file but i'd prefer a php script
can anyone help me with this please?
Last edited by steve51184; 01-23-2009 at 01:13 PM.
hey i need a php script to format and display a select amount of text from a file or a cron job that'll do it (with grep etc) and out put to a file but whatever is easier
i want to display all the banned ip's i have in my .htaccess file
i have a lot of lines in my .htaccess file but i have a line that read like this:
the 3 test ip's are 123.123.123.123 and i want the "\" stripping and the "|" removing and each ip to be on it's own line like this:
123.123.123.123
123.123.123.123
123.123.123.123
i'm not bothered if this is a php script that'll read the .htaccess file and display the output or a cron job that'll run every x mins and output it to a .txt file but i'd prefer a php script
So can I use grep to strip that line from the file to a new file then use SED to strip the junk?
If so can anyone make me a little script please?
Yes, you can use grep to burp that line through sed. And I'm sure there are lots of folks on here that CAN make you a script. The question is: are they willing to do work for you, for free?
A bash shell script tutorial can be found here http://www.freeos.com/guides/lsst/. Lots more tutorials are on Google, and you were provided with reference to the appropriate PHP function, which you had originally asked about.
well that's the thing i don't know php so i haven't written anything :\
Ok, in your first post you mentioned PHP. I assumed that meant you had knowledge of it. Have you gone through the bash scripting tutorial? Looked at ANY of the thousands of example scripts you can find via Google?
i have knowledge about php as in i can edit it very well i just can't make a whole entire script with it and yes i've looked at the docs for sed and awk but again makes no sence to me as i don't/can't make scripts
i'm sure it wouldn't take to long for someone to code me up a little script
Last edited by steve51184; 01-26-2009 at 11:45 AM.
i have knowledge about php as in i can edit it very well i just can't make a whole entire script with it and yes i've looked at the docs for sed and awk but again makes no sence to me as i don't/can't make scripts
i'm sure it wouldn't take to long for someone to code me up a little script
You're right, it wouldn't take too long. But I doubt there's anyone here that will do work for you for free. You can hire a programmer or consultant, or look at any of the THOUSANDS of bash scripts and tutorials you can find through Google, and gain the knowledge yourself.
but what is the point in this forum if no one will help? i thought it was it was here for?
Yes...HELP. Post what scripts you've written, and what error(s) you get, and you will get help.
Ask someone to write you a script, because you don't want to do it, won't get you anything. You've been pointed to links giving you the information you need. This isn't the "free programmer forum", where you post a question and get back scripts.
Yes...HELP. Post what scripts you've written, and what error(s) you get, and you will get help.
Ask someone to write you a script, because you don't want to do it, won't get you anything. You've been pointed to links giving you the information you need. This isn't the "free programmer forum", where you post a question and get back scripts.
wow so rude!! i never said i don't want to do it i'd LOVE to be able to code but i can't and i've really really tried to but i just can't so don't say i won't when i can't!!!
anyway if this was just a bash script someone would've helped like they always do but cos it's php no one will
also you've replied to this topic 6 times over 4 days wouldn't it have been quicker for you to make it?
wow so rude!! i never said i don't want to do it i'd LOVE to be able to code but i can't and i've really really tried to but i just can't so don't say i won't when i can't!!!
anyway if this was just a bash script someone would've helped like they always do but cos it's php no one will
also you've replied to this topic 6 times over 4 days wouldn't it have been quicker for you to make it?
Not being rude to you, but being honest.
I've said from the very beginning that I'm not going to do your work for you, period. I doubt anyone will. If you can't do it, find someone else at your company who can. You've been given links to the PHP function that can do it easily, along with examples, and been pointed to the relevant commands (sed and awk), along with a bash scripting tutorial, but it doesn't appear that you've looked in to any of those resources, or done anything except ask people to write your scripts for you.
This can be done with bash or php..you pick. You say you've "really really tried". Post what you've done and the errors, and we can help you figure out what's wrong. Put some effort forth on your side, and you will get help. If you don't want to do anything but ask someone else to do your work for you, don't complain when they don't.
If you want help, post what you've done and the errors. If you want someone to write this for you, hire a consultant.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.