[K12OSN] parse from shell comand

Petre Scheie petre at maltzen.net
Wed Feb 15 21:26:20 UTC 2006


That's cool!  Why do you have it announce logins?  Just because you can?  (which is as 
good a reason as any ;-) )

Doug Simpson wrote:
> Hi Petre,
> 
> I asked you earlier about the parsing the /etc/passwd file and you helped 
> me tremendously!
> 
> While I do log logins via samba, my server also uses festival to verbally 
> announce logins. I reconfigured it using the grep line you gave me in a 
> creative way and now it states the user's full name, what machine they 
> logged into and what server. (server is redundant, but it is in there 
> anyway. . .)
> 
> Now, instead of festival trying to pronounce (in-coherently) the cryptic 
> username, it states the full name as listed in the /etc/passwd file.
> 
> Also, it logs the user in the login.log with their full name instead of 
> their cryptic login name.
> 
> SUPPER-DEE-DUPER!
> 
> Doug Simpson
> Technology Specialist
> DeQueen Public Schools
> DeQueen, AR 71832
> simpsond at leopards.k12.ar.us
> Tux for President!
> 
> On Wed, 15 Feb 2006, Petre Scheie wrote:
> 
>> for x in <list of login IDs>
>> do
>> echo $x
>> grep $x /etc/passwd|cut -d: -f5
>> done
>>
>> This will give you the ID and the full name associated with it, assuming it's in the 
>> fifth field of /etc/passwd.  <list of login IDs> could be a file, in which case the 
>> syntax would be
>>
>> for x in `cat file_with_IDs`
>> do
>> echo $x
>> grep $x /etc/passwd|cut -d: -f5
>> done
>>
>> Petre
>>
>> Doug Simpson wrote:
>>> How can I make a script that would parse a line in the passwd file to 
>>> return the full name of a user instead of outputting the entire line?
>>>
>>> purpose: I have logins logged and it sends the login name to a log and it 
>>> uses the %U (logins via samba to a samba PDC) in the log.  To my knowlege, 
>>> there is no way to make it return the full name so I want to take the %U 
>>> and run it through grep or something so it takes the username, finds it in 
>>> /etc/passwd and returns the full name to be entered into the log instead 
>>> of the username.
>>>
>>> Cornfussed, yet?
>>>
>>> Thanks!
>>>
>>> Doug Simpson
>>> Technology Specialist
>>> DeQueen Public Schools
>>> DeQueen, AR 71832
>>> simpsond at leopards.k12.ar.us
>>> Tux for President!
>>>
>>> _______________________________________________
>>> K12OSN mailing list
>>> K12OSN at redhat.com
>>> https://www.redhat.com/mailman/listinfo/k12osn
>>> For more info see <http://www.k12os.org>
>>>
>> _______________________________________________
>> K12OSN mailing list
>> K12OSN at redhat.com
>> https://www.redhat.com/mailman/listinfo/k12osn
>> For more info see <http://www.k12os.org>
>>
> 
> _______________________________________________
> K12OSN mailing list
> K12OSN at redhat.com
> https://www.redhat.com/mailman/listinfo/k12osn
> For more info see <http://www.k12os.org>
> 




More information about the K12OSN mailing list