[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: need help with bash command



On Thu, 2008-11-20 at 17:27 +0100, François Cerbelle wrote:
> Le Jeu 20 novembre 2008 16:18, tôba a écrit :
> > icon_3620_0_1.jpg
> > icon_3616_0_1.jpg
> > icon_3563_0_1.jpg
> >
> > The goal is to create a directory called 3620 and move the
> > icon_3620_0_1.jpg file into this directory.
> >
> > So, I did like this for test:
> > # for a in `ls | sed -e s'/_/ /g' | awk '{print $2}'`; do echo
> > icon_$a_0_1.jpg; done
> 
> for a in `ls`; do DIR=`echo $a | cut -d_ -f2`;  echo  mkdir -p $DIR
> /$a; echo rmdir $DIR/$a; echo mv $a $DIR/$a;  done
...

Why do this with a `ls` when a simple * will work?

for a in *; do ...

> 
-- 
Bob McGowan

Attachment: smime.p7s
Description: S/MIME cryptographic signature


Reply to: