Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: 2 more questions



Hi,

first, a LOT of thanks to you all for all of your answers! :-))

My second problem was easily solved by print -l which fits my needs  
perfectly. It's the same as echo "$VARIABLE" in sh (the quotes make  
for a newline there) which doesn't work in zsh.


The first, however, proved more tricky, mainly because I failed to  
make clear that I'd really need the stdout of the foregoing process  
in a VARIABLE, because I need it TWO times in the command  
afterwards.

Actually, my task was the following:

    cat $FILE | mv $FIELD1_IN_LINEX_OF_FILE $FIELD2_IN_LINEX_OF_FILE

I thought I had read of such a variable in zsh somewhere and just  
couldn't find it anymore, but judging by your comments I was simply  
mistaken.

What I tried then was a

      $(cat $FILE | awk '{printf("mv %s %s\n",$1,$2)}')

This works perfectly with only one line in $FILE, but I couldn't  
get it to work with more than one. Obviously the shell interprets  
the WHOLE output of &(...) as always ONE SINGLE command no matter  
what I do.

So I ended up with

      IFS="
      "
      LINES=($(cat $FILE))
      IFS=$DEFAULT_IFS
      for LINE in $LINES
      do
      $(echo $LINE | awk '{printf("mv %s %s\n",$1,$2)}')
      done

which is the best solution I was able to find.

Thanks again!


                Bye
                        Uli

______________________________________________________________________

Uli Zappe               E-Mail: uli@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
                                (NeXTMail,Mime,ASCII) PGP on request
Lorscher Strasse 5      WWW:    -
D-60489 Frankfurt       Fon:    +49 (69) 9784 0007
Germany                 Fax:    +49 (69) 9784 0042

staff member of NEXTTOYOU - the German NEXTSTEP/OPENSTEP magazine
______________________________________________________________________



Messages sorted by: Reverse Date, Date, Thread, Author