Re: New line in bash variables pain

2006-11-14 Thread Oron Peled
On Tuesday, 14 בNovember 2006 22:31, Maxim Vexler wrote: > Thanks to everyone for the help, all solution worked. > To sum up the tips: Hey, what's the rush? I didn't have my take yet ;-) Let's do it in simple one liner: sed -e N -e 's/\n/ = /' passwd.fake Cheers, -- Oron Peled

Re: New line in bash variables pain

2006-11-14 Thread michael
This was a very educational thread. Thanks for posing the question and the summary, and thanks everyone for the useful answers. I don't have a need for this just yet, but I have saved the thread as I am sure the answers will be useful sooner or later. I eagerly await the next educational thread.

Re: New line in bash variables pain

2006-11-14 Thread Maxim Vexler
On 11/14/06, Oded Arbel <[EMAIL PROTECTED]> wrote: [snip] (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,

Re: New line in bash variables pain

2006-11-14 Thread Ariel Biener
On Tuesday 14 November 2006 12:34, Ehud Karni wrote: I don't understand why all this voodoo is needed. If you have a list of spaced delimited values and want to use a for or while loop to read them, just fix $IFS locally (the default of IFS is tab or space or newline). You can make $IFS only be ne

Re: New line in bash variables pain

2006-11-14 Thread Valery Reznic
What about something like following: while read line; do case "x$line" in x) # empty line, do nothing ;; x[ | x]) # you don't like brackets, do nothing too ;; *) # Everything else set -- $line # Now $1

Re: New line in bash variables pain

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

Re: New line in bash variables pain

2006-11-14 Thread Ehud Karni
On Tue, 14 Nov 2006 11:56:18 Maxim Vexler wrote: > > I'm having the most annoying issue with bash, one related to space > delimited variables. [snip] > > Here's an example: > > san-svn:/var/lib/svn# cat passwd.fake > [users] > user1 = password1 > user2 = password2 > [snip] > > I'd like to automat

New line in bash variables pain

2006-11-14 Thread Maxim Vexler
Hi list, any bash gurus in the house ? I'm having the most annoying issue with bash, one related to space delimited variables. I'd like to get a list in the form of : <<< user1 password1 user2 password2 Instead I'm getting: <<< user1 password1 user2 password2 Here's an example: san-svn:/

Re: New line in bash variables pain

2006-11-14 Thread Amos Shapira
On 14/11/06, Maxim Vexler <[EMAIL PROTECTED]> wrote: Hi list, any bash gurus in the house ?I'm having the most annoying issue with bash, one related to spacedelimited variables.I'd like to get a list in the form of :<<>>Instead I'm getting:<<

Re: New line in bash variables pain

2006-11-14 Thread Oded Arbel
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 approac