display the userid's of a file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers display the userid's of a file
# 1  
Old 10-15-2008
display the userid's of a file

what command can I use to display the userid's only of a file; specifially the /etc/passwd file?
# 2  
Old 10-15-2008
ls -ln
will do the trick (the -n options actually)
# 3  
Old 10-15-2008
I'm trying to display the userid's in the /etc/passwd file, but not display any other information from the file

ls lists to much information
# 4  
Old 10-16-2008
Error

ls -n | cut -16-21,55-100 will display the userid and filename only. Just try this.
# 5  
Old 10-20-2008
> ls lists to much information
PERFECT !
better have than not to have, correct ?

I'll give you a fishing-rod not a fish, cause I believe this will help you develop your shell skills better, the good point to start would be:
man cut
man awk
have fun!
# 6  
Old 10-21-2008
Bug

u can use either the sed or cut command

cut -d ":" -f3,5 /etc/passwd | tr ":" " "

or by using sed

sed "s/\(.*\):\(.*\):\(.*\):\(.*\):\(.*\):\(.*\)/\3 \5" /etc/passwd

will give the user id and username only.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to read userid and password information from txt file

Hi Experts, I am writing a shell script (for displaying disk space details) which is logging to 15 different servers using following command. ssh userid@servername It is prompting me for password for all 15 servers when I manually run it. However , soon I would like to schedule this script... (4 Replies)
Discussion started by: ajaypatil_am
4 Replies

2. UNIX for Dummies Questions & Answers

userid and pw

questions: a. where can I customized the password of userid in solaris? say I wanted 10digits long, all caps? thanks (4 Replies)
Discussion started by: lhareigh890
4 Replies

3. Solaris

See who is logging in with a userid

Hi all. Quick question. How can I tell if someone is logging in to our unix servers with an application id and not their personal id? Thanks (2 Replies)
Discussion started by: jamie_collins
2 Replies

4. Shell Programming and Scripting

What is the command to get name associated with userid?

Hi, 1#what is the command to get name associated with userid? 2#I am using unix on Mainframes thru OMVS. So any one know to to capture TSO command output to a variable on OMVS environment. I tried with below script, but its not working! #!/bin/ksh output=$(tso whois PA1234) echo... (6 Replies)
Discussion started by: prashant43
6 Replies

5. Red Hat

userid with nothing to do on the os/app

Hi All, I got this userid apache with the same userid and groupid and /sbin/nologin and the /www/a home folder is empty. Can I just delete this userid? How can I investigate if userid have something to do with the application? Thanks for any comment you may add. (1 Reply)
Discussion started by: itik
1 Replies

6. Shell Programming and Scripting

validating the userid and passwd

Hi i need to write a script which perform some action only when an existing and privliged user is running it. It will call another script where user ID and password are required. So in main script before calling another script I need userID and password validation....for that I can check... (0 Replies)
Discussion started by: ashish_uiit
0 Replies

7. Shell Programming and Scripting

Increment userid in file

Hello, does anyone know how to increment a userid(number) written in any scripting language that works on a shell? For example: I have a HTML file in this format: userid: name: telephone: Every time I execute my script it adds the same fields, except with the userid incremented. Like... (2 Replies)
Discussion started by: dejavu88
2 Replies

8. UNIX for Advanced & Expert Users

userid

I would like to know the difference between the real user-id and the effective user-id. If user-A runs a program owned by user-B then which is the real user-id and which is the effective user-id ? (1 Reply)
Discussion started by: sundaresh
1 Replies

9. Shell Programming and Scripting

date and userid

Hi I am trying to write a script to check the log files for the trancactions based on usr input date and user input user id. I will take the user input userid and user input date and check there are any creation deletion happened, if so mail it other wise say no transactions; I got user... (2 Replies)
Discussion started by: gundu
2 Replies

10. UNIX for Dummies Questions & Answers

validating userid

What's wrong with this syntax? It's part of my 'if' statement but it doesn't seem to pass and it keeps going to the 'else' part. I thought it says that userid must start with a non-numeric character and is between 6 and 10 characters long (alphanumeric). $userid|grep -Eq '^?\{6,10\}+$' if... (2 Replies)
Discussion started by: giannicello
2 Replies
Login or Register to Ask a Question