Re: printing variable values seperately.

From: tridentadm (tridentadm_at_softhome.net)
Date: 05/20/05


Date: 19 May 2005 20:54:38 -0700

sorry i didnt provide much clarity on my request.

i have a 'for loop' which is used for some other purpose.
so i dont want to use a for loop here.

eg.
cnt=0;
# consider $name would have "myproc yourproc ourproc"
for name in `ps -ef |grep pmon |grep -v grep |awk {'print $1'}`
do
    echo $name

    # consider var= "these three words"
    # I want to print each word seperately .
    echo $var[cnt+1];
done

OUTPUT :
myproc
these

yourproc
three

ourproc
words"

--
hope i am clear
ps. if i give a 'for loop' for $var also, the output would vary, (isnt
it??)


Relevant Pages

  • Re: break statement
    ... possible setting a boolean flag" ... > NO GOTO PLEASE ... > dont achieve things any better then using while/loops/fors.... ... > inner loop and a flag to get off the outer one or yet anothe break. ...
    (microsoft.public.dotnet.framework)
  • Re: Linked lists
    ... I dont know how you manage your linked list, ... You also need to "nullify" some pointers when you delete an item, ... endless loop. ... I suck in ASM ...
    (alt.lang.asm)
  • Re: wxPython.button.disabled still catching clicks
    ...     for i in range: ... nothing happens but when loop ends another one is started because ... is to reposition button outside frame instead of disabling it but this ... I dont know how it works because i ...
    (comp.lang.python)
  • Re: accessing other array indexes other than the current of a foreach
    ... Use foreach but keep a counter as well: ... the previous line of the foreach loop. ... I dont like the idea of copying alot of data around because there ... I have found a way to do it copying variables if ...
    (perl.beginners)
  • Re: change value and concatenate
    ... The purpose of the for loop is to shift down all the fields so that, ... shifted down by two sonce $4 and $5 have been unified. ...
    (comp.lang.awk)