Re: need help with bash command

2008-11-25 Thread s. keeling
François Cerbelle <[EMAIL PROTECTED]>: > Bob McGowan a écrit : > > > > Why do this with a `ls` when a simple * will work? > > for a in *; do ... > > Hum... Because ! ;-) > > In fact, first, I used to do this, because I seldomly use all files in a > single directory, but often a pattern in a

Re: need help with bash command

2008-11-21 Thread François Cerbelle
Le Ven 21 novembre 2008 02:10, Ding Honghui a écrit :.jpg > [EMAIL PROTECTED]:~/test/jpg$ ls | awk -F_ '{print $2}' > 3563 > 3616 > 3620 IMHO, awk is quite oversized just to cut fields... It is typically a cut job : "cut -d_ -f2" ;-) Fanfan -- http://www.cerbelle.net - http://www.afdm-idf.org

Re: need help with bash command

2008-11-20 Thread tôba
On Fri, 21 Nov 2008 09:10:08 +0800 Ding Honghui <[EMAIL PROTECTED]> wrote: > tôba wrote: > > Hello, > > > > Can you help me with a bash command? > > I a directory, I want to extract with a command line for jpg name > > files. I have a lot of: > > > > icon_3620_0_1.jpg > > icon_3616_0_1.jpg > > i

Re: need help with bash command

2008-11-20 Thread Ding Honghui
tôba wrote: > Hello, > > Can you help me with a bash command? > I a directory, I want to extract with a command line for jpg name files. > I have a lot of: > > icon_3620_0_1.jpg > icon_3616_0_1.jpg > icon_3563_0_1.jpg > > I want to extract the number betwen icon_*_0_1.jpg AND I want to use > the

Re: need help with bash command

2008-11-20 Thread François Cerbelle
Bob McGowan a écrit : 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 ... Hum... Because ! ;-) In fact, first, I used to do this, because I seldomly use

Re: need help with bash command

2008-11-20 Thread H.S.
tôba wrote: > Hello, > > Can you help me with a bash command? > I a directory, I want to extract with a command line for jpg name files. > I have a lot of: > > icon_3620_0_1.jpg > icon_3616_0_1.jpg > icon_3563_0_1.jpg > > I want to extract the number betwen icon_*_0_1.jpg AND I want to use > the

Re: need help with bash command

2008-11-20 Thread Bob McGowan
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. > > > > S

Re: need help with bash command

2008-11-20 Thread François Cerbelle
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 '{prin

[SOLVED] Re: need help with bash command

2008-11-20 Thread tôba
On Thu, 20 Nov 2008 13:28:17 -0200 Eduardo M KALINOWSKI <[EMAIL PROTECTED]> wrote: > tôba escreveu: > > Hello, > > > > Can you help me with a bash command? > > I a directory, I want to extract with a command line for jpg name > > files. I have a lot of: > > > > icon_3620_0_1.jpg > > icon_3616_0_1.

Re: need help with bash command

2008-11-20 Thread Eduardo M KALINOWSKI
tôba escreveu: > Hello, > > Can you help me with a bash command? > I a directory, I want to extract with a command line for jpg name files. > I have a lot of: > > icon_3620_0_1.jpg > icon_3616_0_1.jpg > icon_3563_0_1.jpg > > I want to extract the number betwen icon_*_0_1.jpg AND I want to use > the

need help with bash command

2008-11-20 Thread tôba
Hello, Can you help me with a bash command? I a directory, I want to extract with a command line for jpg name files. I have a lot of: icon_3620_0_1.jpg icon_3616_0_1.jpg icon_3563_0_1.jpg I want to extract the number betwen icon_*_0_1.jpg AND I want to use the entire filename too in the same com