[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How to grep only ID's

Posted on 2010-11-27
6
Medium Priority
?
384 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
Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

 

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
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

649 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