LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Newbie
User Name
Password
Linux - Newbie This forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Tags used in this thread
Popular LQ Tags

Reply
 
Thread Tools
Old 10-22-2009, 09:36 AM   #1
cleve23
LQ Newbie
 
Registered: Jul 2009
Posts: 7
Thanked: 0
Have some Coding problem!!!!! Please help :D thanks


[Log in to get rid of this advertisement]
I want to compare the uid in /etc/passwd. But i have no idea on how to compare with the huge numbers of row and columns? Please help me.
Thanks
windows_vista cleve23 is offline  
Tag This Post
Reply With Quote
Old 10-22-2009, 09:40 AM   #2
druuna
Senior Member
 
Registered: Sep 2003
Location: netherlands
Distribution: lfs
Posts: 3,269
Thanked: 78
Hi,

Compare the (/etc/passwd) uid to what? and what needs to be done if it is (not) found?
druuna is offline     Reply With Quote
Old 10-22-2009, 09:42 AM   #3
Lordandmaker
Member
 
Registered: Sep 2005
Location: London, UK
Distribution: Debian, Ubuntu, DSL
Posts: 248
Thanked: 14
Firstly, you _really_ want to make your title more accurately reflect the content of the post. At best, you're going to attract bored programmers.

Secondly, you need to make your question more specific. What do you want to compare the values with? What's the actual problem you're trying to solve?


The 'standard' manual for how to ask questions that get useful answers quickly is ESR's How To Ask Questions The Smart Way.
I've written a decidedly less thorough but substantially shorter version at http://aviswebsite.co.uk/asking-questions/

I'd rather you read the former, but if you're not going to, at least read the latter, please.
linuxdebian Lordandmaker is offline     Reply With Quote
Old 10-24-2009, 12:33 AM   #4
cleve23
LQ Newbie
 
Registered: Jul 2009
Posts: 7
Thanked: 0

Original Poster
Sorry if i make my question not clear. Sorry.
I need to make sure that the uid are unique and has no repeat uid in the /etc/passwd file. I tried using loop but i did not mange to do it.
windows_vista cleve23 is offline     Reply With Quote
Old 10-24-2009, 03:15 AM   #5
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835
Thanked: 136
Quote:
Originally Posted by cleve23 View Post
Sorry if i make my question not clear. Sorry.
I need to make sure that the uid are unique and has no repeat uid in the /etc/passwd file. I tried using loop but i did not mange to do it.
So show us your code.
linuxfedora lutusp is offline     Reply With Quote
Old 10-24-2009, 08:13 AM   #6
geek.ksa
Member
 
Registered: Jan 2009
Location: Dhahran, Saudi Arabia
Distribution: RHEL 5
Posts: 33
Thanked: 3
Quote:
Originally Posted by cleve23 View Post
I need to make sure that the uid are unique and has no repeat uid in the /etc/passwd file. I tried using loop but i did not mange to do it.
To print a list of uids that are duplicate in your passwd file:

cut -d: -f3 /etc/passwd | sort | uniq -d

To print a list of uniq uids:

cut -d: -f3 /etc/passwd | sort | uniq -u


Hope this helps
windows_vista geek.ksa is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Some insight on whats going wrong [Not a coding problem, but concept problem] imoracle Linux - Newbie 5 11-14-2008 12:49 AM
Problem with HTML coding bigalexe Programming 1 10-06-2006 02:26 AM
Javascript coding problem Hockeyfan Programming 1 02-01-2006 08:23 AM
problem coding odd loop shams Programming 3 07-17-2004 02:22 PM
problem coding conditional operators shams Programming 1 07-13-2004 08:39 PM


All times are GMT -5. The time now is 05:54 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration