Score:1

Grep - How to suppress the "Is a directory" line?

br flag

When running

grep 'string' *

I'm getting the following messages:

grep: some-directory: Is a directory
grep: other-directory: Is a directory

How to suppress those messages?

bac0n avatar
cn flag
Does this answer your question? [How to use grep on all files non-recursively in a directory?](https://askubuntu.com/questions/777379/how-to-use-grep-on-all-files-non-recursively-in-a-directory)
Score:5
bd flag

-s, --no-messages: Suppress error messages about nonexistent or unreadable files.

grep -s 'string' *
CPH avatar
in flag
CPH
Also, redirecting error messages to /dev/null. I.e. `grep 'string' * 2> /dev/null`
bac0n avatar
cn flag
`grep -d skip 'string' *`
Score:0
br flag

There are at least two ways to suppress error messages ("Is a directory"):

  1. grep -s 'string' *

  2. grep 'string' * 2> /dev/null

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.