-
January 18th, 2005, 01:50 PM
#11
Junior Member
Hi ya'll, this is my first post here. I've been using a find/perl line for years to accomplish what you want. Here it is:
Code:
find /some/starting/dir -type f -name '.htaccess' -depth \
-exec perl -pi.BAK \
-e 's#Require user userid_a, userid_b, userid_c#Require user userid_a, userid_c#g' {} \;
For each .htacess file found perl will first create a .htaccess.BAK file for those "oh crap I made a big mistake" times. I hope it's helpful to you.
-
January 18th, 2005, 07:06 PM
#12
Originally posted here by Guus
Hmm, while on that subject: what's the general feeling here about using PHP with the command line interface?
Dunno about the general feeling, but PHP doesn't hold a candle to Perl in terms of pattern searching and replacing speed and functionality. Perl really is designed as a commandline scripting language, PHP is largely a web based languages, so much of the language's capabilities focus on that.
The whole point of the shebang line though is to give you the ability to support whatever you like. If you find PHP is good for you, use it.
Chris Shepherd
The Nelson-Shepherd cutoff: The point at which you realise someone is an idiot while trying to help them.
\"Well as far as the spelling, I speak fluently both your native languages. Do you even can try spell mine ?\" -- Failed Insult
Is your whole family retarded, or did they just catch it from you?
-
January 18th, 2005, 11:30 PM
#13
I have had a poopoo time with PHP CLI.
It's been a while so things may have changed but I remember getting frustrated and
running the PHP through LYNX as PHP CLI was causing my head to grey faster than
I would have liked.
IIRC it was simple CRON schedules of simple code but we were rushed and went with
what worked.
-
January 19th, 2005, 09:25 AM
#14
Originally posted here by chsh
Dunno about the general feeling, but PHP doesn't hold a candle to Perl in terms of pattern searching and replacing speed and functionality. (...)
Sure, there's a world of difference between Perl and PHP - but lets not look at the differences but at the similarities instead. I think (or rather, I'd like your opinion on the matter) that with either one of them you could do 90% of the tasks you'd do with the other. If that's true, wouldn't that mean that most people could cope with just one of the languages?
I wish to express my gratitude to the people of Italy. Thank you for inventing pizza.
-
January 19th, 2005, 09:37 AM
#15
same can be said about bash..
sure you'd need to use a lot of externall apps like sed, awk etc.. but hey.. it works..
ASCII stupid question, get a stupid ANSI.
When in Russia, pet a PETSCII.
Get your ass over to SLAYRadio the best station for C64 Remixes !
-
January 19th, 2005, 09:42 AM
#16
Bash would be severly platform-dependant though.
I wish to express my gratitude to the people of Italy. Thank you for inventing pizza.
-
January 19th, 2005, 10:06 PM
#17
Originally posted here by Guus
Sure, there's a world of difference between Perl and PHP - but lets not look at the differences but at the similarities instead. I think (or rather, I'd like your opinion on the matter) that with either one of them you could do 90% of the tasks you'd do with the other. If that's true, wouldn't that mean that most people could cope with just one of the languages?
Sure, the functionality exists, but just because it exists in the language doesn't necessarily mean that it's entirely simple to make use of it. It's just simpler to write perl scripts to parse log files for instance. Perl is also faster at a lot of things more common to command line scripting.
PHP on the CLI is also a slightly different animal than it is as a web language, so again you're still having to learn new stuff, and IMO if you're learning new stuff anyways, why not just go for the gusto and pick up a language designed around the idea of data extraction and report generation that has all the filesystem crawling functionality you need?
As for cross-platform capability, you won't find it easy to do cross-platform work on PHP either, and IIRC there are some security hazards to doing PHP command scripting on Windows.
Again, it's just my opinion, and really if you don't have the time that's perfectly understandable. At some point you should make the time however.
Chris Shepherd
The Nelson-Shepherd cutoff: The point at which you realise someone is an idiot while trying to help them.
\"Well as far as the spelling, I speak fluently both your native languages. Do you even can try spell mine ?\" -- Failed Insult
Is your whole family retarded, or did they just catch it from you?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|