SUMMARY: nawk question

From: Raed Al-Zou'bi (ralzoubi@just.edu.jo)
Date: Mon Jul 31 2000 - 04:26:08 CDT


Thanks for the fast replies
thanks to David Beaudoin,Brett Lymn, Sanjiv K. Bhatia,and Matthew Stier.
the original question was :
" > Dear Sun admins,
>
> I am sorry It may be silly question, even I did that before but could
not
> remember how
> anyway, I have file A which contains a list of users id they are part of
their
> home directories in /etc/passwd ( file B )
> I am trying to use nawk to search and get all the lines of file B (
/etc/passwd
> ) with the key of file A
> I was trying to use:
> # cat A | nawk ' { systems ( " grep " $1 )}' B
> that does not give me anything
> remember that A contains 8 digit number in each line
> and B is a copy of the /etc/passwd
>
> Best Regards and thanks in advance
> "

I tried two suggestions :

David Beaudoin suggested using:

cat A | xargs -I {} grep {} /etc/passwd

also Sanjiv K. Bhatia suggested using aloop such as :

#!/bin/ksh

for key in `cat fileA`
do
    grep $key fileB
done > outfile

Best Regards
and thanks again
Raed Al-Zoub'i

S
U BEFORE POSTING please READ the FAQ located at
N ftp://ftp.cs.toronto.edu/pub/jdd/sun-managers/faq
. and the list POLICY statement located at
M ftp://ftp.cs.toronto.edu/pub/jdd/sun-managers/policy
A To submit questions/summaries to this list send your email message to:
N sun-managers@ececs.uc.edu
A To unsubscribe from this list please send an email message to:
G majordomo@sunmanagers.ececs.uc.edu
E and in the BODY type:
R unsubscribe sun-managers
S Or
. unsubscribe sun-managers original@subscription.address
L To view an archive of this list please visit:
I http://www.latech.edu/sunman.html
S
T



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:14:13 CDT