[NBLUG/talk] bash shell commands
Jeremy Turner
jeremy at linuxwebguy.com
Tue Sep 2 17:41:02 PDT 2003
On Tue, 2003-09-02 at 17:39, Andru Luvisi wrote:
> Another tip:
>
> Since grep will print out filenames if it has more than one argument, here
> is a way to make sure it always shows a filename, even if find only finds
> one file:
> find ./dir -type f -print |xargs grep 'stuff' /dev/null
>
> grep won't find anything in /dev/null, but having it there will make sure
> that grep prints out the filename. For example:
>
> luvisi at gladen:~$ grep root /etc/group
> root:*:0:
> luvisi at gladen:~$ grep root /dev/null /etc/group
> /etc/group:root:*:0:
> luvisi at gladen:~$
Maybe grep -H root /etc/group ?
Grep manpage:
-H, --with-filename
Print the filename for each match.
Jeremy
--
Jeremy Turner <jeremy at linuxwebguy.com>
The LinuxWebGuy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://nblug.org/pipermail/talk/attachments/20030902/577a3076/attachment.pgp
More information about the talk
mailing list