SUMMARY: nawk question

From: Raed Al-Zou'bi (
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
> remember how
> anyway, I have file A which contains a list of users id they are part of
> home directories in /etc/passwd ( file B )
> I am trying to use nawk to search and get all the lines of file B (
> ) 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 :


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

Best Regards
and thanks again
Raed Al-Zoub'i

U BEFORE POSTING please READ the FAQ located at
. and the list POLICY statement located at
A To submit questions/summaries to this list send your email message to:
A To unsubscribe from this list please send an email message to:
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:

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