2

When I do a grep foo * I get a number of warnings like this:

grep: dir1: Is a directory grep: dir2: Is a directory grep: dir3: Is a directory grep: dir4: Is a directory grep: dir5: Is a directory 

I would rather just see the results rather than these warnings.

1 Answer 1

3

grep foo * --directories=skip will skip grepping directories like regular files.

As per the man page:

 -d action, --directories=action Specify the demanded action for directories. It is `read' by default, which means that the directories are read in the same manner as normal files. Other possible values are `skip' to silently ignore the directories, and `recurse' to read them recursively, which has the same effect as the -R and -r option. 

Also, grep foo * -s will do something similarly satisfying.

 -s, --no-messages Silent mode. Nonexistent and unreadable files are ignored (i.e. their error messages are suppressed). 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.