On 11/7/05, m ike <[EMAIL PROTECTED]> wrote:
> > n=0;  for old in `ls -1 *.txt`;  do ((n+=1));  s=`printf '%04d' $n`; 
> > new=${old/.txt/--$s.txt}; mv -vi $new; done
>
> some nifty alterations for GNU bash, version 3.00.0(1)-release 
> (i586-suse-linux)
>
> adding a percent symbol, as in
>
>   ${old/%.txt/--$s.txt};
>
> forces matching at the end

I suppose this is good in case you have files named foo.txt.txt

>  while adding an extra slash, as in
>
>    ${old//.txt/--$s.txt};
>
> makes it global

    carl
--
    carl lowenstein         marine physical lab     u.c. san diego
                                                 [EMAIL PROTECTED]


--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to