From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 30460 invoked from network); 7 Oct 2020 09:51:44 -0000 Received: from minnie.tuhs.org (45.79.103.53) by inbox.vuxu.org with ESMTPUTF8; 7 Oct 2020 09:51:44 -0000 Received: by minnie.tuhs.org (Postfix, from userid 112) id 7D2D99CF8B; Wed, 7 Oct 2020 19:51:40 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id 3DDBA9CF82; Wed, 7 Oct 2020 19:51:06 +1000 (AEST) Received: by minnie.tuhs.org (Postfix, from userid 112) id D63749CF6D; Wed, 7 Oct 2020 19:51:03 +1000 (AEST) X-Greylist: delayed 340 seconds by postgrey-1.36 at minnie.tuhs.org; Wed, 07 Oct 2020 19:51:02 AEST Received: from ste-pvt-msa2.bahnhof.se (ste-pvt-msa2.bahnhof.se [213.80.101.71]) by minnie.tuhs.org (Postfix) with ESMTPS id 937699CF59 for ; Wed, 7 Oct 2020 19:51:02 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by ste-pvt-msa2.bahnhof.se (Postfix) with ESMTP id B0FA93F549 for ; Wed, 7 Oct 2020 11:45:12 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at bahnhof.se Received: from ste-pvt-msa2.bahnhof.se ([127.0.0.1]) by localhost (ste-ftg-msa2.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8bnBJJXaHUXQ for ; Wed, 7 Oct 2020 11:45:11 +0200 (CEST) Received: by ste-pvt-msa2.bahnhof.se (Postfix) with ESMTPA id 944843F26A for ; Wed, 7 Oct 2020 11:45:11 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by localhost (Postfix) with ESMTPS id D9FD52E1D82 for ; Wed, 7 Oct 2020 11:45:18 +0200 (CEST) Date: Wed, 7 Oct 2020 09:45:17 +0000 From: Michael =?utf-8?B?S2rDtnJsaW5n?= To: tuhs@minnie.tuhs.org Message-ID: References: <202010070922.0979MUD2022625@freefriends.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <202010070922.0979MUD2022625@freefriends.org> Subject: Re: [TUHS] Origins of globbing X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" On 7 Oct 2020 03:22 -0600, from arnold@skeeve.com: >> Possibly wrongly, I judge glob by things like how simple it is, to use >> it doing "rename *.foo to *.bar" or "find filenames with spaces in >> them, and rename to be - separated" > > I often use a > > find ... | sed 's/whatever/mv & other/' | sh -x > > for fancy things like that. If I'm doing the same operation a lot, > I wrap it in a script. I like rename from https://metacpan.org/release/File-Rename for that purpose. It takes a regular expressions (actually, Perl expression, so could in principle be any valid Perl code) plus a set of file names, and renames each file according to the regexp. Plus you don't need to worry about things like quoting within the command as with the above, and it even has -0 for when reading those extra-exotic file names from stdin. (For one thing, I hope none of your files has a space or a semicolon in its name with your style of rename as-is. :)) In Debian, that's https://packages.debian.org/stable/rename; I suspect other systems with reasonably large package repositories also offer it prepackaged. About the only downside is its dependence on Perl (after all, that's rather heavyweight), but then again a lot of other things also depend on Perl so it's kind of hard to have even a minimal modern system that doesn't have Perl installed... Having to escape every '.' would probably be even more annoying than modern GNU ls's default non-"-N" behavior; and worse in the sense that _most_ of the time, it would probably work without escaping it, but when it doesn't work, it would break in various spectacular fashions. -- Michael Kjörling • https://michael.kjorling.se • michael@kjorling.se “Remember when, on the Internet, nobody cared that you were a dog?”