On Wed, 2004-11-10 at 21:34 +0530, dipankar das wrote:
> On Thursday 04 November 2004 10:39, Rajarshi Guha wrote:
> > On Wed, 2004-11-03 at 21:28, dipankar das wrote:
> > 
> > > When renaming MSW upper-case filenames to lowercase,
> > > there is 'lc' from shtools, and other ways too. Or, for
> > > massive multiway multioption renaming there are heavy-duty
> > > packages like 'krename'.

> Thank you for the suggestion. Never used 'tr' before. Now made a script with 
> 'tr'. But obviously Debashish was the last one to like you. His 126 lines 
> code was rendered useless by this 17 lines script. It does exactly the same 
> thing. 

Sorry for that :)

BTW, the script mentions converting space to dots *and* upper case to
lower case. So heres a one liner:

echo 'hello is HERE.txt' | tr -s ' ' '.' | tr '[A-Z]' '[a-z]'

gives me 

hello.is.here.txt

(And it also handles multiple spaces)

> dipankar das
> -----------------------------------------------------------------------------
> #!/bin/bash
> # changename, glt, 2004
> echo Changing Filename
> echo From upper-case to lower and eliminating whitespace
> echo "1 replaces whitespace with dot (.)"
> echo "2 annihilates whitespace"
> echo What is your option?
> read option
> for oldfile in *
> do
> test $option -eq 1 && newfile=`echo $oldfile| tr [:upper:] [:lower:]| tr 
> [:blank:] '.'`
> test $option -eq 2 && newfile=`echo $oldfile| tr [:upper:] [:lower:]| tr -d 
> [:blank:]`
> test $option -eq 1 || test $option -eq 2 || echo Are you literate? && exit
> if [ "$newfile" != "$oldfile" ]
> then
> mv "$oldfile" "$newfile"
> fi
> done
> --------------------------------------------------------------------------------
> 
> --
> To unsubscribe, send mail to [EMAIL PROTECTED] with the body
> "unsubscribe ilug-cal" and an empty subject line.
> FAQ: http://www.ilug-cal.org/node.php?id=3
> 
-------------------------------------------------------------------
Rajarshi Guha <[EMAIL PROTECTED]> <http://jijo.cjb.net>
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
-------------------------------------------------------------------
Heisenberg may have been here.



--
To unsubscribe, send mail to [EMAIL PROTECTED] with the body
"unsubscribe ilug-cal" and an empty subject line.
FAQ: http://www.ilug-cal.org/node.php?id=3

Reply via email to