Operating System - HP-UX
1827293 Members
1393 Online
109717 Solutions
New Discussion

How to search a specific users?

 
SOLVED
Go to solution
Chua Wen Ching
Regular Advisor

How to search a specific users?

I need some help here. I am using hp-ux 10.20. For example, i had a file which contains user's logon name.

users.txt
---------
amin
amina
amin2
amin chua
eric1
erica

If i use this command,
cat users.txt | grep amin
i will see
output -> amin, amina, amin2 and amin chua

How can i grep a specific user with only the keyword "amin" using bourne shell programming even there is such a user called amin chua will be ignore? I want amin only. Hope you all can help me. Thank you.
wenching
2 REPLIES 2
James Murtagh
Honored Contributor
Solution

Re: How to search a specific users?

Hi,

You can use "grep -x amin". The string will match the exact line of input, so it will work if the file is of the format you have specified.

Regards,

James.
Chua Wen Ching
Regular Advisor

Re: How to search a specific users?

Thank you very much for your reply.
wenching