Re: Setting Multiple Shell Variables from One Run of awk

2008-10-01 Thread Tzafrir Cohen
On Tue, Sep 30, 2008 at 01:48:46PM -0500, Martin McCormick wrote: > Right now, I have a shell script that does the following: > > hostname=`echo $NEWDEV |awk 'BEGIN{FS="."}{print $1}'` > domain=`echo $NEWDEV |awk 'BEGIN{FS="."}{print $2}'` > top0=`echo $NEWDEV |awk 'BEGIN{FS="."}{print $3}'`

Re: Setting Multiple Shell Variables from One Run of awk

2008-10-01 Thread Bob McGowan
Mumia W.. wrote: On 09/30/2008 01:48 PM, Martin McCormick wrote: <--deleted problem description and awk solution--> The bash shell can do this internally since it supports arrays: NEWDEV=${NEWDEV//./ } NEWDEV=($NEWDEV) echo "hostname: ${NEWDEV[0]}" echo "domain: ${NEWDEV[1]}" echo "top0:

Re: Setting Multiple Shell Variables from One Run of awk

2008-09-30 Thread Mumia W..
On 09/30/2008 01:48 PM, Martin McCormick wrote: Right now, I have a shell script that does the following: hostname=`echo $NEWDEV |awk 'BEGIN{FS="."}{print $1}'` domain=`echo $NEWDEV |awk 'BEGIN{FS="."}{print $2}'` top0=`echo $NEWDEV |awk 'BEGIN{FS="."}{print $3}'` top1=`echo $NEWDEV |awk

Re: Setting Multiple Shell Variables from One Run of awk

2008-09-30 Thread Bob McGowan
Martin McCormick wrote: Right now, I have a shell script that does the following: hostname=`echo $NEWDEV |awk 'BEGIN{FS="."}{print $1}'` domain=`echo $NEWDEV |awk 'BEGIN{FS="."}{print $2}'` top0=`echo $NEWDEV |awk 'BEGIN{FS="."}{print $3}'` top1=`echo $NEWDEV |awk 'BEGIN{FS="."}{print $4

Re: Setting Multiple Shell Variables from One Run of awk

2008-09-30 Thread Ken Irving
On Tue, Sep 30, 2008 at 01:48:46PM -0500, Martin McCormick wrote: > Right now, I have a shell script that does the following: > > hostname=`echo $NEWDEV |awk 'BEGIN{FS="."}{print $1}'` > domain=`echo $NEWDEV |awk 'BEGIN{FS="."}{print $2}'` > top0=`echo $NEWDEV |awk 'BEGIN{FS="."}{print $3}'`

Re: Setting Multiple Shell Variables from One Run of awk

2008-09-30 Thread Bob McGowan
Martin McCormick wrote: Right now, I have a shell script that does the following: hostname=`echo $NEWDEV |awk 'BEGIN{FS="."}{print $1}'` domain=`echo $NEWDEV |awk 'BEGIN{FS="."}{print $2}'` top0=`echo $NEWDEV |awk 'BEGIN{FS="."}{print $3}'` top1=`echo $NEWDEV |awk 'BEGIN{FS="."}{print $4

Setting Multiple Shell Variables from One Run of awk

2008-09-30 Thread Martin McCormick
Right now, I have a shell script that does the following: hostname=`echo $NEWDEV |awk 'BEGIN{FS="."}{print $1}'` domain=`echo $NEWDEV |awk 'BEGIN{FS="."}{print $2}'` top0=`echo $NEWDEV |awk 'BEGIN{FS="."}{print $3}'` top1=`echo $NEWDEV |awk 'BEGIN{FS="."}{print $4}'` That looks in