I have 2 almost identical greps:
[Alex@localhost tmp]$ grep /bin/bash /etc/passwd
root:x:0:0:root:/root:/bin/bash
AlexL:x:500:500::/home/AlexL:/bin/bash
user1:x:501:501:user1 12345:/home/user1:/bin/bash
vs.
[AlexL@localhost tmp]$ grep /bin/*sh /etc/passwd
/etc/passwd:root:x:0:0:root:/root:/bin/bash
/etc/passwd:AlexL:x:500:500::/home/AlexL:/bin/bash
/etc/passwd:user1:x:501:501:user1 12345:/home/user1:/bin/bash
In 2nd query I got filename prefix for every line match.
I know that to get the same result I need to put -h option in 2nd grep, but my question is:
Why do they return different output? Should I add something more?
The task consist of retrieving from /etc/passwd real users (w/o daemons and system users).
Used: CentOS 6.4, grep gnu 2.6.3 version