using sed

Thomas Kwon kwon at sybil.cs.Buffalo.EDU
Sat Dec 9 04:47:04 AEST 1989


I'm a novice hacker who is trying to use 'sed' to extract "certain
string" of "certain column" of "certain line" of a result of a "certain
command". 
Since that sounds too confusing, here is what I really mean. By typing
'ruptime' at the prompt, I get something like the following :

  antares       up 21+04:15,     4 users,  load 1.36, 1.50, 1.29
  castor        up  1+05:20,     0 users,  load 0.00, 0.00, 0.00
  deneb         up 42+23:50,     0 users,  load 0.00, 0.00, 0.00
  gort          up 14+14:47,    21 users,  load 2.48, 1.77, 1.59
  joey          up 14+14:42,     2 users,  load 0.00, 0.05, 0.26
  marvin        up 14+15:03,    10 users,  load 1.43, 1.34, 1.12
  sybil         up 14+11:28,    33 users,  load 2.83, 2.93, 2.44
  wolf          up 70+20:41,     0 users,  load 1.46, 1.49, 1.28

I want to extract the string "1.34" which is in "column 8" of "line 6"
and set that to a variable. How can this be done?
So far, I've been experimenting with : 

     set string=`ruptime|sed  <Then I got stuck here>`

Any help will be greatly appreciated.

                                                    Tom Kwon. *-)



More information about the Comp.unix.questions mailing list