[HPADM] RE: SUMMARY: Matching File Records

From: Whittemore, Dale (dale.whittemore@lmco.com)
Date: Wed Jun 13 2007 - 13:07:48 EDT


Oops, small typo there on the redirect.
The actual command I used was:
grep -f <username list> <passwd file list> | uniq > <matched records file>

-----Original Message-----
From: hpux-admin-owner@DutchWorks.nl [mailto:hpux-admin-owner@DutchWorks.nl]
On Behalf Of Whittemore, Dale
Sent: Wednesday, June 13, 2007 10:54 AM
To: hpux-admin@DutchWorks.nl
Subject: [HPADM] SUMMARY: Matching File Records

Thanks for all the quick responses.

Steve Sandau suggested "grep -f file1 file2 > outputfile and Jeff Lightner
suggested the join command which when used with the -j option produces the
same output as the one Steve Sandau suggested. Both produce two lines of
the same thing but I can overcome by piping the 'uniq' command before
redirecting to the output file.
The command I used to get what I wanted was:
grep -f <username list> <passwd file list> | uniq | <matched records file>

Thanks again.

Dale Whittemore
Unix System Administrator, Sr.
Lockheed Martin EIS
 

-----Original Message-----
From: hpux-admin-owner@DutchWorks.nl [mailto:hpux-admin-owner@DutchWorks.nl]
On Behalf Of Whittemore, Dale
Sent: Wednesday, June 13, 2007 10:23 AM
To: hpux-admin@DutchWorks.nl
Subject: [HPADM] Matching File Records

I have two different files, one containing just a user login names and
another containing fields 1 and 5 of the passwd file.
I want to create a file that has only those records in the second file that
match the user names in the first file. Is there any quick way to do this
using the diff command or should I do a Perl script. I know nothing of AWK
and VERY little about SED.

Thanks

Dale Whittemore
Unix System Administrator, Sr.
Lockheed Martin EIS


--
             ---> Please post QUESTIONS and SUMMARIES only!! <---
        To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl
       Name: hpux-admin@dutchworks.nl     Owner: owner-hpux-admin@dutchworks.nl
 
 Archives:  ftp.dutchworks.nl:/pub/digests/hpux-admin       (FTP, browse only)
            http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse & search)



This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 11:02:56 EDT