LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Have some Coding problem!!!!! Please help :D thanks (https://www.linuxquestions.org/questions/linux-newbie-8/have-some-coding-problem-please-help-d-thanks-763708/)

cleve23 10-22-2009 08:36 AM

Have some Coding problem!!!!! Please help :D thanks
 
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 :D

druuna 10-22-2009 08:40 AM

Hi,

Compare the (/etc/passwd) uid to what? and what needs to be done if it is (not) found?

Lordandmaker 10-22-2009 08:42 AM

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.

cleve23 10-23-2009 11:33 PM

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.

lutusp 10-24-2009 02:15 AM

Quote:

Originally Posted by cleve23 (Post 3730535)
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.

geek.ksa 10-24-2009 07:13 AM

Quote:

Originally Posted by cleve23 (Post 3730535)
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


All times are GMT -5. The time now is 01:12 PM.