The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Eliminating CR (new lines) from a file. KornFire UNIX for Dummies Questions & Answers 4 01-29-2009 06:06 AM
Eliminating characters between two expressions arsheshadri HP-UX 1 06-26-2008 08:00 AM
Reducing Risk Versus Eliminating Risk iBot IT Security RSS 0 05-29-2008 02:50 PM
UrgentPlease: compare 1 value with file values eliminating special characters kittusri9 Shell Programming and Scripting 10 04-28-2008 04:51 AM
Eliminating whitespaces during reading of a field. videsh77 Shell Programming and Scripting 4 12-13-2004 12:52 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-17-2009
mikejreading mikejreading is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 22
Unhappy Eliminating duplicates from the who command

I am trying to show how many users are logged into one of my systems. Using who -q it gives me a user count, but some users are logged in multiple times.

Is there any easy parameter that I can use to ignore/eliminate these duplicates??

Thanks
  #2 (permalink)  
Old 03-17-2009
gehlnar gehlnar is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 46
Can you try with who|uniq , see whether you are get rid of dups.

Cheers,
gehlnar
  #3 (permalink)  
Old 03-17-2009
mikejreading mikejreading is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 22
No... no joy :-(,

who|uniq outputted exactly the same as the who command without the pipe.
  #4 (permalink)  
Old 03-17-2009
Padow Padow is offline
Registered User
  
 

Join Date: Dec 2008
Location: Maryland
Posts: 177
Code:
who | awk '{ print $1 }' | sort -u
  #5 (permalink)  
Old 03-17-2009
va2206 va2206 is offline
Registered User
  
 

Join Date: Feb 2009
Posts: 7
Hi,

This one also can help.

who | awk '{print $1}' | uniq
  #6 (permalink)  
Old 03-17-2009
Goldorakk's Avatar
Goldorakk Goldorakk is offline
Registered User
  
 

Join Date: Feb 2009
Location: France
Posts: 43
Code:
who | cut -f1 -d' ' | sort | uniq
  #7 (permalink)  
Old 03-17-2009
mikejreading mikejreading is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 22
Thanks, that has listed all the unique users, how would I then calculate the amount of users, like who -q shows #users... any thoughts?
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 02:23 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0