On Sat, 27 Feb 1999, Matt McClure wrote:
> Try this:
>
> [mmcclure@mercury test]% ls
> test 1 test 2 test test 1 test test test 1
> [mmcclure@mercury test]% perl
> while (<*>) {
> $file = $_;
> s/\ /_/g;
> rename $file, $_;
> }
> [mmcclure@mercury test]% ls
> test_1 test_2 test_test_1 test_test_test_1
>
> -Matt
>
> Ken Lai wrote:
> >
> > Say I want to rename files in a directory to change spaces to "_":
> >
> > I've tried using a "for" construct in bash and tcsh, but neither could
> > catch the whole filename. e.g.
> >
> > # bash:
> > for FILE in *; do
> > ls $FILE
> > done
> >
> > # tcsh:
> > foreach FILE ( * )
> > ls $FILE
> > end
> >
> > Neither of the above could list the files, both only gave me bunches of
> > file-not-found messages for name fragments.
> >
> > --
> > # Ken Lai <min-ken.lai@yale.edu> also at ken.lai@WriteMe.com
> > # http://pantheon.yale.edu/~ml267/ ICQ# 5845632
>
-- # Ken Lai <min-ken.lai@yale.edu> also at ken.lai@WriteMe.com # http://pantheon.yale.edu/~ml267/ ICQ# 5845632