MLUG: Re: [MLUG] Need Program, Mind Not Working
Re: [MLUG] Need Program, Mind Not Working
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
On Thu, 6 Dec 2001, Mike Miller wrote:

> > (1) Use ls -1 or find to get a list of filenames and store that in file1
> > (2) tr '[A-Z] ' '[a-z]_' < file1 > file2
> > (3) paste file1 file2 | sed 's/ /\\ /g' > scriptfile
> > (4) awk -F\t '{print "mv "$file1" "$file2}' scriptfile > scriptfile2
> > (5) chmod u+x scriptfile2
> > (6) scriptfile2
> >
> > Then use an ls or find command to get the full list of new filenames
> > with paths.
>
> One proviso: That method assumes the directory names do not contain
> spaces.


Oh.  I just realized:  It also assumes that directory names do not contain
upper case characters!  That's more likely to be a problem, I guess.
Well, it looks like you have lots of perl-coders to help you out anyway.

Jeez.  I just realize this was wrong too:

(4) awk -F\t '{print "mv "$file1" "$file2}' scriptfile > scriptfile2

Should have been:

(4) awk -F\t '{print "mv "$1" "$2}' scriptfile > scriptfile2

Of course, the problems I mentioned with directory names wouldn't exist if
you were to run within directories.

Mike

--
To unsubscribe, go to http://mlug.missouri.edu/members/edit.php

Archives are available at http://mlug.missouri.edu/list-archives/