Re: [opensuse] Add variables to standard output for
- From: Henne Vogelsang <hvogel@xxxxxxxxxxxx>
- Date: Fri, 18 Jan 2008 15:33:35 +0100
Hi,
On Friday, January 18, 2008 at 11:52:35, Dirk Moolman wrote:
Ok, I don't know how to word my question properly. I am writing a
script that greps for a string (for a command that has multiple lines of
output - the finger command)
My problem: I want to take the standard output (1) from a grep
command, but I also want to add my own values to the resulting line.
Let's use a simple example:
My script:
-----------
for i in `sort /etc/passwd | cut -f1 -d":"`
do
finger $i | grep -i last
done
The output will look like this:
Last login Mon Jan 14 11:23 (SAST) on 39 from 163.197.208.90
BUT, I want to add the user's login to the lines above, for example:
$i: Last login Fri Jan 18 09:32 (SAST) on 57 from 163.197.212.133
for i in `sort /etc/passwd | cut -f1 -d":"`
do
if blubb=`finger $i | grep Last`; then
echo "$i: $blubb";
fi
done
Henne
--
Henne Vogelsang, openSUSE.
Everybody has a plan, until they get hit.
- Mike Tyson
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx
- Follow-Ups:
- RE: [opensuse] Add variables to standard output for
- From: Dirk Moolman
- RE: [opensuse] Add variables to standard output for
- References:
- [opensuse] OpenSuse 10.3 shutting down by itself
- From: Shibu Basheer
- Re: [opensuse] [OT] Einstein's Plagiarism
- From: kanenas
- Re: [opensuse] [OT] Einstein's Plagiarism
- From: Aaron Kulkis
- Re: [opensuse] [OT] Einstein's Plagiarism
- From: kanenas
- [opensuse] Add variables to standard output for
- From: Dirk Moolman
- [opensuse] OpenSuse 10.3 shutting down by itself
- Prev by Date: Re: [Kiwi-devel] [opensuse] openSUSE 10.3 and LTSP
- Next by Date: Re: [Kiwi-devel] [opensuse] openSUSE 10.3 and LTSP
- Previous by thread: [opensuse] Add variables to standard output for
- Next by thread: RE: [opensuse] Add variables to standard output for
- Index(es):
Relevant Pages
|