delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/04/14/15:02:24

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
To: cygwin AT cygwin DOT com
From: Andrew Schulman <andrex AT alumni DOT utexas DOT net>
Subject: Re: [ANNOUNCEMENT] Updated: cygutils-1.2.7-1
Date: Thu, 14 Apr 2005 14:59:30 -0400
Lines: 37
Message-ID: <MPG.1cc8879a5fc6b1b19896fb@localhost>
References: <20050413050050 DOT 4F97A57D98 AT cygbert DOT vinschen DOT de> <m1at51hc6feo83p4h7jmoet6fiiu0ch6nf AT 4ax DOT com> <20050414173737 DOT GB12274 AT trixie DOT casa DOT cgf DOT cx> <871x9d5ir6 DOT fsf AT peder DOT flower>
Mime-Version: 1.0
X-Complaints-To: usenet AT sea DOT gmane DOT org
X-Gmane-NNTP-Posting-Host: pcp04399769pcs.nrockv01.md.comcast.net
User-Agent: MicroPlanet-Gravity/2.70.2067
X-Archive: encrypt
X-IsSubscribed: yes

>    $ head -1 /usr/bin/rename
>    #!/usr/bin/perl -w

Yes, Debian includes a perl script /usr/bin/rename, which seems more 
powerful than Cygwin rename:

NAME
       rename - renames multiple files

SYNOPSIS
       rename [ -v ] [ -n ] [ -f ] perlexpr [ files ]

DESCRIPTION
       "rename" renames the filenames supplied according to the rule 
       specified as the first argument.  The perlexpr argument is a Perl 
       expression which is expected to modify the $_ string in Perl for 
       at least some of the filenames specified.  If a given filename is 
       not modified by the expression, it will not be renamed.  If no 
       filenames are given on the command line, filenames will be read 
       via standard input.

       For example, to rename all files matching "*.bak" to strip the 
       extension, you might say

               rename 's/\.bak$//' *.bak

       To translate uppercase names to lower, you'd use

               rename 'y/A-Z/a-z/' *

This is a more powerful approach, because it uses Perl regexps.  OTOH, 
that makes it hard for non-Perl initiates to use.

Maybe this rename could also be included in Cygwin under a different 
name, say rename2 or prename.

A.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019