Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: modify multiple .htaccess files at once?

  1. #11
    Junior Member
    Join Date
    Jan 2005
    Posts
    1
    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.

  2. #12
    Senior Member
    Join Date
    Nov 2001
    Posts
    1,255
    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?

  3. #13
    Senior Member
    Join Date
    Mar 2004
    Location
    Colorado
    Posts
    421
    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.

  4. #14
    Hi mom!
    Join Date
    Aug 2001
    Posts
    1,103
    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.

  5. #15
    Leftie Linux Lover the_JinX's Avatar
    Join Date
    Nov 2001
    Location
    Beverwijk Netherlands
    Posts
    2,534
    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 !

  6. #16
    Hi mom!
    Join Date
    Aug 2001
    Posts
    1,103
    Bash would be severly platform-dependant though.
    I wish to express my gratitude to the people of Italy. Thank you for inventing pizza.

  7. #17
    Senior Member
    Join Date
    Nov 2001
    Posts
    1,255
    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
  •