Solved

How to grep only ID's

Posted on 2010-11-27
6
330 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
  • 3
  • 2
6 Comments
 
LVL 48

Accepted Solution

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

Assisted Solution

by:expert_tanmay
expert_tanmay earned 333 total points
Comment Utility
grep -e '^100[03]' /etc/passwd
0
 
LVL 9

Expert Comment

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

-e is not needed
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:9334gonzalez
Comment Utility
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
Comment Utility
try without -e
0
 

Author Closing Comment

by:9334gonzalez
Comment Utility
Thank you,
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
What is ISQL? 6 99
Mac - rsync folders with / in name 5 59
Open Camera IP 8 90
Delete email that have a topic like  Cpanel 3 46
If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
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.

763 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now