> 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, while adding an extra slash, as in

   ${old//.txt/--$s.txt};

makes it global


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

Reply via email to