Add log feature to script: "Replace " "  with «  »  inside the xml files"

Posted on 2006-04-13
Last Modified: 2010-03-05
Feature Request on below script please.
- Create log file to list names of those files changed by ->  if s/(<title>.*?)"(.*?)"/$1«$2»/s;

100 Bonus points due to slight urgent need...

use open ':utf8';
use File::Find;

    print STDERR "$File::Find::name\n";
    return unless /\.xml$/;
    local @ARGV=($_);local $^I=".bak";
    while( <> ){ print STDERR "$1«$2»\n" if s/(<title>.*?)"(.*?)"/$1«$2»/s; print; }
Question by:ClaySmith
    1 Comment
    LVL 84

    Accepted Solution

    open LOG,">>logfile");
        return unless /\.xml$/;
        local @ARGV=($_); local $^I=".bak"; local $/="</title>"; local $changed;
        while( <> ){ $changed=1 if s/(<title>.*?)"(.*?)"/$1«$2»/s; print; }
        print LOG "$File::Find::name changed\n" if $changed;
    close LOG;

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
    In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now