#see docs at the bottom
use strict;
use warnings;
use Cwd;
use File::Find;
my $search_pattern=$ARGV[0] ;
my $replace_pattern =$ARGV[1];
my $file_pattern = $ARGV[2];
# Usage
(@ARGV == 3 ) || die ("Usage: FindAndReplace.pl findPattern ReplacePattern FilePattern");
find(\&d, cwd);
sub d {
my $file = $File::Find::name;
$file =~ s,/,\\,g;
return unless -f $file;
return unless $file =~ /$file_pattern/;
use Tie::File ;
tie my @file_array , 'Tie::File', $file , memory => 100_000_000 or die "I cannot find the $file" ;
foreach my $line (@file_array) #foreach line of the file
{
if ( $line =~ /$search_pattern/igo )
{
print "found " . $line ;
print "replacing \n" ;
}
$line =~ s/$search_pattern/$replace_pattern/igo ;
}
untie @file_array ;
}
#Purpose : performs recursive find and replace based on pеrl regexes from the current directory
#the search and replace is case insensitive
Getting the Current TabItem when the Tab is not selected in WPF
-
[image: Banner]
This is a quick reminder to self on how to retrieve a TabItem from a WPF
TabControl *when the tab is not currently selected* because I ru...
1 week ago
No comments:
Post a Comment
- the first minus - Comments have to be moderated because of the spammers
- the second minus - I am very lazy at moderating comments ... hardly find time ...
- the third minus - Short links are no good for security ...
- The REAL PLUS : Any critic and positive feedback is better than none, so your comments will be published sooner or later !!!!