[ale] xargs w/ tr

Fletch fletch at phydeaux.org
Fri Jan 3 16:53:49 EST 2003


>>>>> "David" == David S Jackson <dsj at sylvester.dsj.net> writes:

[...]

    David> Like using xargs to set variable names, something like

    David> whatever|xargs -J % name=% newname=`echo $name|tr A-Z a-z`


        That's still not going to work because the backtics will be
expanded before xargs ever sees them.


... | rename 'y/A-Z/a-z/'


#!/usr/bin/perl -w
# rename - Larry's filename fixer
$op = shift or die "Usage: rename expr [files]\n";
chomp(@ARGV = <STDIN>) unless @ARGV;
for (@ARGV) {
    $was = $_;
    eval $op;
    die $@ if $@;
    rename($was,$_) unless $was eq $_;
}


-- 
Fletch                | "If you find my answers frightening,       __`'/|
fletch at phydeaux.org   |  Vincent, you should cease askin'          \ o.O'
770 294-0820 (m)      |  scary questions." -- Jules                =(___)=
                      |                                               U
_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale






More information about the Ale mailing list