[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 390
  • Last Modified:

How to grep only ID's

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
9334gonzalez
Asked:
9334gonzalez
  • 3
  • 2
3 Solutions
 
TintinCommented:
awk -F: '$3==1000 || $3==1003 {print}' /etc/passwd
0
 
expert_tanmayCommented:
grep -e '^100[03]' /etc/passwd
0
 
expert_tanmayCommented:
sorry it will be
grep '^100[03]' /etc/passwd

-e is not needed
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
9334gonzalezAuthor Commented:
grep -e '^100[03]' /etc/passwd


I tried this one and I didn't get any did I missed something
0
 
expert_tanmayCommented:
try without -e
0
 
9334gonzalezAuthor Commented:
Thank you,
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now