Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FInger and cut (sounds painful doesn't it) 1

Status
Not open for further replies.

GirlInTrouble

Technical User
May 27, 2004
12
GB
Hi there you guys ;-)

Im trying to get the first 3 fields from a finger -s command
I've tried using cut but that doesn't work.

who |cut -d" " -f1|xargs finger -s|cut -d" " -f1,2,3

The output of finger is seperated with multiple spaces. Do I used IFS again? How do I say my delimiter is junk? I tried -s on cut - no use though. I also tried pr (from last time ;-) )
Any ideas boys?

Thanks
 
;-) I was holding off trying to learn perl until I was proficient at shell! (BTW it looks scary!) Are you saying its easier to do it in perl or impossible to do it in ksh?
I figured something in awk might do it don't you think?
I had a really good photocopy from an old sco manual about awk. Lost it though, might be worth trying to dig out. This is an exercise in learning, so hey if you think I might be able to do it in awk don't tell me yet...
I WILL try your idea, just out of curiosity though.
Thanks toolkit
 
Its a lot easier to do it in perl. Perl's pattern matching and split functions alike are second to none.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top