Hi Ron,
Ron Johnson <ron.l.johnson@cox.net> writes:
> bash sure is making things difficult...
>
> $ for f in "`ls -1 |grep ' '`";
> > do
> > x=`echo $f | tr ' ' '-'`
> > echo "@$f@ @$x@"
> > done
> @foo bar
> foo snafu@ @foo-bar-foo-snafu@
>
> What I want is:
> @foo bar@ @foo-bar@
> @foo snafu@ @foo-snafu@
Hmm, if you want to replace ' ' with '-', you can do it as follow:
$ for f in `ls | grep ' ' | tr ' ' '-'`; do echo "@$f@"; done
@foo-bar@
@foo-snafu@
For printing both original and new file names:
$ ls | grep ' ' | perl -ne 'chop; print "\@$_\@"; s/ /-/g; print "\t\@$_\@\n";'
@foo bar@ @foo-bar@
@foo snafu@ @foo-snafu@
Hope this help,
-- Yuji Yamano <yyamano@kt.rim.or.jp> The music spread everywhere. In the mouth. In the armpits. In the crotch. The music a way of flying up and flying past. --Susan Sontag ___________________ Nolug mailing list nolug@nolug.orgReceived on 04/16/03
This archive was generated by hypermail 2.2.0 : 12/19/08 EST