a question about GREP

Ben Scott dragonhawk at gmail.com
Mon Mar 26 12:23:37 EDT 2007


On 3/26/07, Jerry <greenmt at gmail.com> wrote:
> Question: "-type f" limits to "regular file", does the so-called "regular
> file" strictly mean "plain text files"?

  No.  "find -type f" will include binary files, executables, and
such.  The "regular file" part means that it is just a file containing
user data -- a "bag of bytes", as one person put it.  As opposed to a
symbolic link, a named pipe (FIFO), or a device node.

> Also, solution from Ben (w/ adding search pattern, which is "zip") and Bill
> (w/ moving "zip" ahead of ".") works:
>
> grep -lwir --include=\*out\* zip . > zip.txt

  You may want to add "-I" to that as well, to exclude binary files,
as Kevin Clark suggested.  That is:

grep -lwirI --include=\*out\* zip . > zip.txt

> Kevin, in your solution (listed below), why are there 2 directory names are
> used? Could you please explain a bit to me?

  I think he's just demonstrating that you can specify multiple
directory names on some implementations of find(1).  You can specify
only one, if you prefer.  On some find(1) implementations, you can
specify no directories at all, which implies the current directory.

-- 
"One day I feel I'm ahead of the wheel / And the next it's rolling over me"
                                                  -- Rush, "Far Cry"


More information about the gnhlug-discuss mailing list