Solved

How to grep only ID's

Posted on 2010-11-27
6
371 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 167 total points
ID: 34222879
awk -F: '$3==1000 || $3==1003 {print}' /etc/passwd
0
 
LVL 9

Assisted Solution

by:expert_tanmay
expert_tanmay earned 333 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
The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

 

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 333 total points
ID: 34222922
try without -e
0
 

Author Closing Comment

by:9334gonzalez
ID: 34222956
Thank you,
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

696 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