Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Single UNIX command to display users and to count them Post 302739407 by bakunin on Tuesday 4th of December 2012 07:12:23 AM
Old 12-04-2012
Quote:
Originally Posted by sreyan32
I need only a single command to display the output of who and then add the total number of users and display at the bottom of that output.
There is no such single command, because that would go against one of the most basic UNIX tenets: do one and do it as good as possible. That means: there is a command to display the users logged in (who, as you have already figured out) and it will do this displaying as good as possible - but it won't count, sort or do any other "after-processing" of its display. This is simply not its job. There is a sort utility for sorting, but it will only do the sorting - it will not generate output of its own. The same goes for line counting (see the wc utility), filtering (see grep, sed, awk and a lot of similar tools) and any other purpose.

Think of the UNIX tools like instrumentalists in an orchestra. You don't expect the trumpet player to play the flute as well. No, you have a world-class flutist to play the flute and a world-class trumpet player to play the trumpet. It is your job to conduct them accordingly to bring out the brilliant and stunning sound they are capable to produce.

I hope this helps.

bakunin
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to use more than one MPE command STREAM with Unix command in a single shell?

Hello, I have problem in writing the shell script involving MPE command STREAM related to HP-UX and Unix command. Script is sh "nlshCMD 'STREAM <job name1>' | 'SHOWJOB' | grep $HPJOBNUM" sh "nlshCMD 'STREAM <job name2>' | 'SHOWJOB' | grep $HPJOBNUM" sh "nlshCMD 'STREAM <job name3>' |... (0 Replies)
Discussion started by: bosskr
0 Replies

2. HP-UX

How to use more than one MPE command STREAM with Unix command in a single shell?

Hello, I have problem in writing the shell script involving MPE command STREAM related to HP-UX and Unix command. Script is sh "nlshCMD 'STREAM <job name1>' | 'SHOWJOB' | grep $HPJOBNUM" sh "nlshCMD 'STREAM <job name2>' | 'SHOWJOB' | grep $HPJOBNUM" sh "nlshCMD 'STREAM <job name3>' |... (1 Reply)
Discussion started by: bosskr
1 Replies

3. UNIX for Dummies Questions & Answers

run command Unix on a single line

Hi everybody.. I need to enter in bash mode and then run a command and this just in a single command line. I tried : "bash ^M| somecommand" but nothing.. How do I do to simulate the return button just right after the bash command ? Thanks.. (8 Replies)
Discussion started by: Riddick61
8 Replies

4. Shell Programming and Scripting

Need a Command To display "echo command value in loop" in single line.

Hi I want to display "echo command value in loop" in single line. My requirement is to show the input file (test_1.txt) like the output file (test_2.txt) given below. Input file :test_1.txt a1|b1|4|5 a1|b1|42|9 a2|b2|32|25 a1|b1|2|5 a3|b3|4|8 a2|b2|14|6 Output file:test_2.txt... (2 Replies)
Discussion started by: sakthifire
2 Replies

5. UNIX for Dummies Questions & Answers

Re: How To Use UNIQ UNIX Command On single Column

Hi , Can You Please let Know How use unix uniq command on a single column for deleting records from file with Below Structure.Pipe Delimter File . Source Name | Account_Id A | 101 B... (2 Replies)
Discussion started by: anudeepkumar123
2 Replies

6. Shell Programming and Scripting

History of all the users in single file with command , date . time , ip and user

HTML Code archive_history() { HISTORYOLD=${HISTFILE}.archive CURTIME=`date` CURTTY=`tty` IP=$(echo $SSH_CLIENT | awk '{print $1}') if ; then echo "#-${HOSTNAME}-- ${CURBASHDATE} - ${CURTIME} ($CURTTY) ${USER} ${IP}----" >> $HISTORYOLD history... (2 Replies)
Discussion started by: rehantayyab82
2 Replies

7. Shell Programming and Scripting

History of all the users in single file with command , date . time , ip and user

HTML Code: archive_history() { HISTORYOLD=${HISTFILE}.archive CURTIME=`date` CURTTY=`tty` IP=$(echo $SSH_CLIENT | awk '{print $1}') if ; then echo "#-${HOSTNAME}-- ${CURBASHDATE} - ${CURTIME} ($CURTTY) ${USER} ${IP}----" >> $HISTORYOLD history... (0 Replies)
Discussion started by: rehantayyab82
0 Replies

8. UNIX for Dummies Questions & Answers

To find and display the middle line in a file using single line command.

Hi all, How can i display the middle line of a file using a single line command? (6 Replies)
Discussion started by: Lakme Pemmaiah
6 Replies

9. UNIX for Beginners Questions & Answers

Get count of multiple word in single command

Hello Experts, I have a log file that contains 4 different type of exception : 1- Exception 2- Fatal 3- Error 4- Exec My requirement is to find count of each type of exception, i tried using combination of -E and -C but that doesn't seems to be working : grep -ec 'Exception' -ec... (4 Replies)
Discussion started by: mukulverma2408
4 Replies

10. UNIX for Beginners Questions & Answers

How to find the count of IP addresses that belong to different subnets and display the count?

Hi, I have a file with a list of bunch of IP addresses from different VLAN's . I am trying to find the list the number of each vlan occurence in the output Here is how my file looks like 1.1.1.1 1.1.1.2 1.1.1.3 1.1.2.1 1.1.2.2 1.1.3.1 1.1.3.2 1.1.3.3 1.1.3.4 So what I am trying... (2 Replies)
Discussion started by: new2prog
2 Replies
Pente(6)							   Games Manual 							  Pente(6)

NAME
pente - Game of five in a row SYNOPSIS
pente -help pente [ <options> ] HOW TO PLAY PENTE
Pente is the American name of a Japanese game called ``ni-nuki'', which is a variant of the ancient game ``go-moku''. Pente is played on a 19x19 grid with stones of two different colors. Each player chooses one set of stones; then the players take turns placing their stones on any unoccupied intersection until one player wins. There are two ways to win. If a player makes five or more stones in a straight line (across, down, or diagonally), then that player wins. Or, if a player captures five pairs of his or her opponent's stones, that player also wins. Stones may be captured in pairs only. To capture a pair of stones, a player must place one stone on either side of the pair. The first move is placed in the center of the board. To make up for the advantage of going first, the first player's second move must be at least three spaces from their first. This sounds confusing, so don't worry about it; just play, and if the computer won't let you move where you want on your second move, play somewhere farther away. That's it! These directions are pretty terse, but if you have an X display there are better directions available through the ``help'' but- ton. You can also try playing a few games; the rules are simple enough that you can pick them up easily just by playing. THE PROGRAM
This program has support for many different display types. Depending on the compile options used, X Windows, Curses, and a plain text for- mat may be available. The exact display type used will be chosen by the program, or it may be selected with a command line switch. Infor- mation on the switches is available with pente -help. Most of the command line switches can also be set with the ``setup'' window of the X interface. Any changes you make there will be saved in the .pente.ad file and remembered the next time that you play. The command line switches can also be set with an X default. For example, if you want to set black and white to be the default mode, you can run pente with pente -nocolor, or you can add pente*color: 0 to your X defaults, or you can just turn off color in the ``setup'' win- dow. Pente will store a new .pente.ad file every time you run it. In this file it will save the current state of Pente. This is handy; you don't normally have to set command line switches since Pente will remember them in the .pente.ad file. BUGS
Sometimes the .pente.ad file gets some bad data in it. Just delete the file and then you can start from scratch again. AUTHOR
Bill Shubert (wms@igoweb.org) French text by Eric Dupas (dupas@univ-mlv.fr) Italian text by Andrea Borgia (email: borgia@cs.unibo.it; homepage: http://www.cs.unibo.it/~borgia) 31 July 2001 Pente(6)
All times are GMT -4. The time now is 10:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy