?
Solved

How to grep only ID's

Posted on 2010-11-27
6
Medium Priority
?
374 Views
Last Modified: 2012-08-13
In the  /etc/passwd directory file. there are several users, I just want to locate the primary user  ID's account that starts with 1000 and 1003.

I did the following grep -e "1000" -e "1003" /etc/passwd  but the output also prints 1020 1028 etc.

I just want the 1000 and the 1003 any suggestions.
0
Comment
Question by:9334gonzalez
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 48

Accepted Solution

by:
Tintin earned 668 total points
ID: 34222879
awk -F: '$3==1000 || $3==1003 {print}' /etc/passwd
0
 
LVL 9

Assisted Solution

by:expert_tanmay
expert_tanmay earned 1332 total points
ID: 34222880
grep -e '^100[03]' /etc/passwd
0
 
LVL 9

Expert Comment

by:expert_tanmay
ID: 34222899
sorry it will be
grep '^100[03]' /etc/passwd

-e is not needed
0
10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

 

Author Comment

by:9334gonzalez
ID: 34222907
grep -e '^100[03]' /etc/passwd


I tried this one and I didn't get any did I missed something
0
 
LVL 9

Assisted Solution

by:expert_tanmay
expert_tanmay earned 1332 total points
ID: 34222922
try without -e
0
 

Author Closing Comment

by:9334gonzalez
ID: 34222956
Thank you,
0

Featured Post

Basic Security of Your VPC

So, you’ve got this shiny new VPC and a fancy new application configured on your EC2 servers ready to go. This application is only accessible from your computer, which is great for security, but you need your users to be able to access it! So, what’s the easiest way to do this?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month8 days, 1 hour left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question