Operating System - HP-UX
1828959 Members
2119 Online
109986 Solutions
New Discussion

Re: Using xargs with finger

 
SOLVED
Go to solution
Chris_226
Occasional Contributor

Using xargs with finger

Hello All.
I am using the following command:

cat /etc/passwd | awk '{print $1}' | xargs -i finger {} > users.dat

It is not creating a continuous list of finger commands like I expected. Rather it is creating something like:

Login name: srao:*:1234:14:Srini In real life: ???
Login name: aperez:*:1235:14:Anton In real life: ???
...

Any ideas why my command would not show the entire output of the finger command?

e.g.
Login name: srao In real life: Srini Rao
Directory: /home/srao Shell: /usr/bin/ksh
Never logged in.
No unread mail
No Plan.

Thanks for your time,
Regards,
C
Greenhorn
2 REPLIES 2
Rodney Hills
Honored Contributor
Solution

Re: Using xargs with finger

You need to tell awk that ":" is the delimiter in /etc/passwd.

cat /etc/passwd | awk -F: '{print $1}' | ...

HTH

-- Rod Hills
There be dragons...
Chris_226
Occasional Contributor

Re: Using xargs with finger

That worked like a charm. Forgot that the passwd file was limited by :'s.

Thanks!!!
Greenhorn