On Tue, 2006-11-14 at 12:05 +0200, Maxim Vexler wrote:
> On 11/14/06, Maxim Vexler <[EMAIL PROTECTED]> wrote:
> san-svn:/var/lib/svn# for pair in `awk '/^[^[].+[^\n]$/ {print $1,$3}'
> passwd.fake`; do echo "$pair" | xargs echo ; done
> user1
> password1
> user2
> password2

I think you are approaching this the wrong way, and you should use $IFS
(bash record separator characters) for this purpose. Compare this:

for pair in `awk '/^[^[].+[^\n]$/ {print $1,$3}' passwd.fake`; do 
echo "$pair"; done

versus

(IFS="$(echo)"; \
for pair in `awk '/^[^[].+[^\n]$/ {print $1,$3}' passwd.fake`; do
echo "$pair"; done)

In the second example, I force the record separator to be only the new
line character (the output from 'echo'. I can probably use \n, but I
wanted to play it safe). Do mind the wrapping of the second form in
parenthesis, otherwise you clobber your global IFS, which is something
you want to avoid.

--
Oded
::..
We make a living by what we get, but we make a life by what we give.
    -- Winston Churchill



=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to