data bases such as /etc/passwd

Steven List steven at luke.UUCP
Mon Jun 17 04:55:00 AEST 1985


In article <298 at bdaemon.UUCP> carl at bdaemon.UUCP (carl) writes:
>> I am working on a program which will have a data base similar to /etc/passwd
>> or /etc/inittab.  Are there any libraries which support these type of files?
>> Specifically, I would like to be able to search for a record based on a
>> certain key, and ask for the nth field in that record.
>
>Why not:
>
>	grep key file | awk -F: 'print $n'
>
>where $n is the nth field?
>
>Cral Brandauer
 ^^^^?

How about:

	grep "^key" file | awk -F: '{print $n}'

Good advice is only good if it's accurate.
-- 
***
*  Steven List @ Benetics Corporation, Mt. View, CA
*  {cdp,greipa,idi,oliveb,sun,tolerant}!bene!luke!steven
***



More information about the Comp.unix mailing list