The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Operating Systems > Linux
.
google unix.com



Linux RedHat, Ubuntu, SUSE, Fedora, Debian, Mandriva, Slackware, Gentoo linux, PCLinuxOS. All Linux questions here!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
changing my username? Bashar Post Here to Contact Site Administrators and Moderators 4 07-08-2007 02:04 PM
Get username in script willc0de4food Shell Programming and Scripting 9 02-13-2007 03:00 AM
how to find my username? kirrran UNIX for Advanced & Expert Users 2 08-07-2006 07:42 PM
Username creation vivek_scv UNIX for Dummies Questions & Answers 1 04-28-2005 08:31 AM
How do I Create a New Username kimjones142001 UNIX for Dummies Questions & Answers 7 09-11-2001 05:17 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-07-2004
test111111 test111111 is offline
Registered User
  
 

Join Date: Oct 2004
Posts: 3
Using NIS-ypmatch, ypcat, Lname, Gname to get username/key

Hello,

We can get the full info by typing:

ypmatch username passwd

aaaa : yyyy: ... ... : LastName Gname : ... ...

However, I'd like to know how could we get the username based on LastName and Given name please?

Thanks a lot,
ly
  #2 (permalink)  
Old 10-07-2004
RTM's Avatar
RTM RTM is offline Forum Advisor  
Hog Hunter
  
 

Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
I don't think you can - if you list the keys for that map, it will be the first entry of each line (the username).

You can ypcat the file (ypcat passwd) and grep for the Last/Given Name and then print the first field (username) with awk.
  #3 (permalink)  
Old 10-07-2004
hassan2 hassan2 is offline Forum Advisor  
Registered User
  
 

Join Date: Mar 2002
Location: London, England
Posts: 262
do

ypmatch username passwd | awk -F: '{print $5}'
  #4 (permalink)  
Old 10-07-2004
test111111 test111111 is offline
Registered User
  
 

Join Date: Oct 2004
Posts: 3
Thanks a lot!

Combining and getting the command:

ypcat passwd | grep "Last name First Name" | awk -F : '{print $5}'

is exact what I am looking for.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:30 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0