• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 193
  • Last Modified:

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

Ozo,
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';
$/="</title>";
use File::Find;

find(sub{
    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; }
},".");
0
ClaySmith
Asked:
ClaySmith
1 Solution
 
ozoCommented:
open LOG,">>logfile");
find(sub{
    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;
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now