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
Solved

How to grep only ID's

Posted on 2010-11-27
6
355 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
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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Linux Filesystems reporting faster growth than actual file growth... 7 74
How to get maximum transfer speed over LAN 4 103
maybe no no httpd.conf 6 61
linux SFTP 8 60
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
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.

790 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