At 10:56 PM 8/24/01, you wrote:
> > This is a newbie list right? [okay, good]  I don't want to be too
> > embarassed to ask a stuped question.

There are NO stupid questions asked, nor are those that are NOT asked 
stupid, just those that do NOT ask their question are.  Do NOT be 
embarassed we all have to crawl before we can install and operate a system, 
if you have a problem give all the details and those that know will 
respond.  Hope that HELPS.



>Well, I'll take a stab at it - but I would think that there is a
>cleaner way to write this.
>
>
> > At 08:34 PM 8/22/2001 -0700, you wrote:
> > > > for i in `ls /dirname | grep -e".+ .+"`; do mv $i `echo $i |
> > >  gawk '{ gsub(_, ,$0) }'` ; done
>
>Well, the 'for i in ' ... construct is going to do something for every
>member of the list. For instance:
>
>for i in 'apple pear peach'
>do
>   echo i ate a $i
>done
>
>Well, that would print out:
>
>i ate a apple
>i ate a pear
>i ate a peach
>
>So, the for iterates over lists, rather than taking on a series of
>sequential values (as in basic and other programming languages).
>
>Stuff in ` ` (back quotes) get interpreted and substituted right into
>the command line. In other words, another process is going out and building
>the list that the for is going to use. I'm not certain about the grep -e
>" .+  .+" part - but it would appear the object is to get a list of files,
>and ls -l returns a long list of those. One of course can simplify this to
>for i in `ls` or eevn for i in *, which returns all files in the directory -
>try 'echo *' at your shell sometime.
>
>So, if we simplify the first construct, it is going to present a new
>filename from the directory and iterate over the full list of files, so
>something will be done to each file name. The something is in the next
>line - the 'mv $i `...` part. Here we also have another use of backquotes:
>the intent is to take the filename we're currently using ($i), and do some
>awk processing on it. Using 'tr' would be far simpler :). The result of
>the awk processing is then put on the command line, which becomes the
>new filename for the 'mv' command.
>
> > Dean
>------------------------------------------------------------------------
>David E. Fox                              Thanks for letting me
>[EMAIL PROTECTED]                            change magnetic patterns
>[EMAIL PROTECTED]               on your hard disk.
>-----------------------------------------------------------------------
>
>Want to buy your Pack or Services from MandrakeSoft?
>Go to http://wwww.mandrakestore.com


Want to buy your Pack or Services from MandrakeSoft? 
Go to http://wwww.mandrakestore.com

Reply via email to