Skip to main content
typos, formatting, `+` instead of `\;`
Source Link
Stéphane Chazelas
  • 584.6k
  • 96
  • 1.1k
  • 1.7k

You can specifiy multiple direcotiesdirectories in grepgrep:

grep -r "string" app/assets/javascripts spec/javascripts

AlternativlyAlternatively - sometimes more usefulluseful is list files to grep by findfind, and then grep them, for example

find app/assets/javascripts spec/javascripts -type f -print0 |xargs|
  xargs -0 grep "string"

or

find app/assets/javascripts spec/javascripts -type f -exec grep -H "string" {} \;+

You can specifiy multiple direcoties in grep:

grep -r "string" app/assets/javascripts spec/javascripts

Alternativly - sometimes more usefull is list files to grep by find, and then grep them, for example

find app/assets/javascripts spec/javascripts -type f -print0 |xargs -0 grep "string"

or

find app/assets/javascripts spec/javascripts -type f -exec grep -H "string" {} \;

You can specifiy multiple directories in grep:

grep -r "string" app/assets/javascripts spec/javascripts

Alternatively - sometimes more useful is list files to grep by find, and then grep them, for example

find app/assets/javascripts spec/javascripts -type f -print0 |
  xargs -0 grep "string"

or

find app/assets/javascripts spec/javascripts -type f -exec grep -H "string" {} +
added 14 characters in body
Source Link
undefine
  • 1.5k
  • 1
  • 11
  • 20

You can specifiy multiple direcoties in grep:

grep -r "string" app/assets/javascripts spec/javascripts

Alternativly - sometimes more usefull is list files to grep by find, and then grep them, for example

find app/assets/javascripts spec/javascripts -type f -print0 |xargs -0 grep "string"

or

find app/assets/javascripts spec/javascripts -type f -exec grep -H "string" {} \;

You can specifiy multiple direcoties in grep:

grep -r "string" app/assets/javascripts spec/javascripts

Alternativly - sometimes more usefull is list files to grep by find, and then grep them, for example

find app/assets/javascripts spec/javascripts -type f |xargs grep "string"

or

find app/assets/javascripts spec/javascripts -type f -exec grep "string" {} \;

You can specifiy multiple direcoties in grep:

grep -r "string" app/assets/javascripts spec/javascripts

Alternativly - sometimes more usefull is list files to grep by find, and then grep them, for example

find app/assets/javascripts spec/javascripts -type f -print0 |xargs -0 grep "string"

or

find app/assets/javascripts spec/javascripts -type f -exec grep -H "string" {} \;
Source Link
undefine
  • 1.5k
  • 1
  • 11
  • 20

You can specifiy multiple direcoties in grep:

grep -r "string" app/assets/javascripts spec/javascripts

Alternativly - sometimes more usefull is list files to grep by find, and then grep them, for example

find app/assets/javascripts spec/javascripts -type f |xargs grep "string"

or

find app/assets/javascripts spec/javascripts -type f -exec grep "string" {} \;