Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!spool.mu.edu!news.cs.indiana.edu!ux1.cso.uiuc.edu!midway!clout!chinet!les From: les@chinet.chi.il.us (Leslie Mikesell) Newsgroups: comp.unix.questions Subject: Re: I'm learning UNIX and I have a simple question Message-ID: <1991Jun20.163739.6883@chinet.chi.il.us> Date: 20 Jun 91 16:37:39 GMT References: Organization: Chinet - Chicago Public Access UNIX Lines: 27 In article jpope@hq.af.mil (i991x) writes: >One of the things I am currently learning is "pipes" and "redirected output." >In the UNIX that I use there is a command "who" which lists the users that >are currently on the system (as well as which terminal, when they logged on, >etc..). The problem is that they are listed one user per line. >I would like to strip off the first field (the id-name) and output to the >screen four columns (four users per line instead of one) without the other >information about where and when they logged in. Recent sysV's have a -q option to just give names and a -n number option to control how many names per line to show with the -q option. But there are any number of ways to manipulate the output from a program into what you want to see, and you should learn at least a few of them. Awk, sed and the shell itself are the most general, pr has some options for columns and formatting. /bin/sh or ksh who | (while read A B do echo $A done) | pr -t -4 Les Mikesell les@chinet.chi.il.us