From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Message-ID: <005801c545b0$c8e3f370$0200a8c0@admin> From: =?koi8-r?B?5M/Sz8fP1yDuycvPzMHK?= To: References: <009f01c544da$20afab30$0200a8c0@admin><4264FA6F.8070803@altlinux.ru><011e01c544de$8f6422a0$0200a8c0@admin> <4264FF23.20302@altlinux.ru><20050419170824.4e443041.vikerness@mail.ru><20050419145316.GB9738@osdn.org.ua> <20050420132829.GR9438@wrars-comp.wrarsdomain> Subject: =?koi8-r?B?UmU6IFtDb21tXSBSZTogW0pUXSDwz8nTyyDJINrBzcXOwQ==?= Date: Wed, 20 Apr 2005 17:56:43 +0400 MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1478 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1478 X-BeenThere: community@altlinux.ru X-Mailman-Version: 2.1.5 Precedence: list Reply-To: community@altlinux.ru List-Id: Mailing list for ALT Linux users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Apr 2005 13:54:16 -0000 Archived-At: List-Archive: List-Post: Проблему поиска и замены текста в файлах с именами по маске на половину решил следующим скриптом, который нашел на сайте http://www.vanta.ru/script/info.php?id=498&clas=2 Не хватает прохода по вложенным папкам. А так просто сказочный скриптик. #!/usr/bin/perl # ==================================================================== # Copyright (c) 1998-2000 Marcus Kazmierczak, marcus@mkaz.com # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # 3. The name of the author may not be used to endorse or promote products # derived from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # ==================================================================== # # # APP: mksr # ORIGIN: August 1999 # # VERSION NUMBER $ver = "ver 0.0.5"; # Last Modified: November 2000 # # Auth: Marcus Kazmierczak # marcus@mkaz.com # http://blazonry.com/perl/ # # DESC: Search and Replace # print "\nmksr Search and Replace $ver\n"; print "Marcus Kazmierczak, marcus\@mkaz.com\n\n"; # TODO LIST # # - ADD Recursion Option ## REQUIRED CPAN MODULES ## # File::Recurse Module bundled with File-Tools 2.0 # download from CPAN site (http://www.perl.com/CPAN//modules/by-module/File/) # use File::Recurse; #### my $find = $ARGV[0]; my $replace = $ARGV[1]; my $glob = $ARGV[2]; @filelist = <*$glob>; if ( (!$find) || (!$replace) || (!$glob) ) { print "Search and replace recursively through the current directory\n"; print "replacing with in each file specified.\n"; print "To use wildcards leave off the * Ex: '.txt' \n\n"; print " mksr \n"; exit(0); } # process each file in file list foreach $filename (@filelist) { print " P: $filename\n"; # retrieve complete file open (IN, "$filename") || die("Error Reading File: $filename $!"); { undef $/; $infile = ; } close (IN) || die("Error Closing File: $filename $!"); $infile =~ s/$find/$replace/g; # write complete file open (PROD, ">$filename") || die("Error Writing to File: $filename $!"); print PROD $infile; close (PROD) || die("Error Closing File: $filename $!"); } print "\nFinished.\n"; exit(0); ----- Original Message ----- From: "Andrey Rahmatullin" To: Sent: Wednesday, April 20, 2005 5:28 PM Subject: Re: [Comm] Re: [JT] Поиск и замена > _______________________________________________ > Community mailing list > Community@altlinux.ru > https://lists.altlinux.ru/mailman/listinfo/community