Skip to main content
Active reading. [<http://english.stackexchange.com/questions/4645/is-it-ever-correct-to-have-a-space-before-a-question-or-exclamation-mark#comment206109_4645>]
Source Link
Peter Mortensen
  • 31.4k
  • 22
  • 110
  • 134

Linux : Get files which contains a specific text using Linux

I want to find files in Linux, in a specific directory without looking into its subdirectories, which contains in their text a specific string. From this answer, iI tried this after removing the r of recursion  :

grep -nw '/path/to/somewhere/' -e "pattern" 

But it not working. I tried also this with skipping directory optin:

grep -rnw -d skip '/path/to/somewhere/' -e "pattern" 

I tried to exclude any directory that itsis different thanfrom the current directory, but also no way:

grep -rnw -exclude-dir '[^.]' '../../path/to/somewhere/' -e "pattern" 

Linux : Get files which contains a specific text

I want to find files in Linux, in a specific directory without looking into its subdirectories, which contains in their text a specific string. From this answer, i tried this after removing the r of recursion  :

grep -nw '/path/to/somewhere/' -e "pattern" 

But it not working. I tried also this with skipping directory optin:

grep -rnw -d skip '/path/to/somewhere/' -e "pattern" 

I tried to exclude any directory that its different than the current directory but also no way

grep -rnw -exclude-dir '[^.]' '../../path/to/somewhere/' -e "pattern" 

Get files which contains a specific text using Linux

I want to find files in Linux, in a specific directory without looking into its subdirectories, which contains in their text a specific string. From this answer, I tried this after removing the r of recursion:

grep -nw '/path/to/somewhere/' -e "pattern" 

But it not working. I tried also this with skipping directory optin:

grep -rnw -d skip '/path/to/somewhere/' -e "pattern" 

I tried to exclude any directory that is different from the current directory, but also no way:

grep -rnw -exclude-dir '[^.]' '../../path/to/somewhere/' -e "pattern" 
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot

I want to find files in Linux, in a specific directory without looking into its subdirectories, which contains in their text a specific string. From thisthis answer, i tried this after removing the r of recursion :

grep -nw '/path/to/somewhere/' -e "pattern" 

But it not working. I tried also this with skipping directory optin:

grep -rnw -d skip '/path/to/somewhere/' -e "pattern" 

I tried to exclude any directory that its different than the current directory but also no way

grep -rnw -exclude-dir '[^.]' '../../path/to/somewhere/' -e "pattern" 

I want to find files in Linux, in a specific directory without looking into its subdirectories, which contains in their text a specific string. From this answer, i tried this after removing the r of recursion :

grep -nw '/path/to/somewhere/' -e "pattern" 

But it not working. I tried also this with skipping directory optin:

grep -rnw -d skip '/path/to/somewhere/' -e "pattern" 

I tried to exclude any directory that its different than the current directory but also no way

grep -rnw -exclude-dir '[^.]' '../../path/to/somewhere/' -e "pattern" 

I want to find files in Linux, in a specific directory without looking into its subdirectories, which contains in their text a specific string. From this answer, i tried this after removing the r of recursion :

grep -nw '/path/to/somewhere/' -e "pattern" 

But it not working. I tried also this with skipping directory optin:

grep -rnw -d skip '/path/to/somewhere/' -e "pattern" 

I tried to exclude any directory that its different than the current directory but also no way

grep -rnw -exclude-dir '[^.]' '../../path/to/somewhere/' -e "pattern" 
added 6 characters in body
Source Link
54l3d
  • 4k
  • 4
  • 35
  • 59

I want to find files in Linux, in a specific directory without looking into its subdirectorywithout looking into its subdirectories, which contains in their text a specific string. From this answer, i tried this after removing the r of recursion :

grep -nw '/path/to/somewhere/' -e "pattern" 

But it not working. I tried also this with skipping directory optin:

grep -rnw -d skip '/path/to/somewhere/' -e "pattern" 

I tried to exclude any directory that its different than the current directory but also no way

grep -rnw -exclude-dir '[^.]' '../../path/to/somewhere/' -e "pattern" 

I want to find files in Linux, in a specific directory without looking into its subdirectory, which contains in their text a specific string. From this answer, i tried this after removing the r of recursion :

grep -nw '/path/to/somewhere/' -e "pattern" 

But it not working. I tried also this with skipping directory optin:

grep -rnw -d skip '/path/to/somewhere/' -e "pattern" 

I tried to exclude any directory that its different than the current directory but also no way

grep -rnw -exclude-dir '[^.]' '../../path/to/somewhere/' -e "pattern" 

I want to find files in Linux, in a specific directory without looking into its subdirectories, which contains in their text a specific string. From this answer, i tried this after removing the r of recursion :

grep -nw '/path/to/somewhere/' -e "pattern" 

But it not working. I tried also this with skipping directory optin:

grep -rnw -d skip '/path/to/somewhere/' -e "pattern" 

I tried to exclude any directory that its different than the current directory but also no way

grep -rnw -exclude-dir '[^.]' '../../path/to/somewhere/' -e "pattern" 
typos
Source Link
Ruslan Osmanov
  • 21.8k
  • 8
  • 52
  • 62
Loading
added 20 characters in body; edited title
Source Link
54l3d
  • 4k
  • 4
  • 35
  • 59
Loading
Source Link
54l3d
  • 4k
  • 4
  • 35
  • 59
Loading