Text Processing: Recursive search and replace

From WikiMLT
Revision as of 11:23, 4 August 2022 by Spas (talk | contribs) (Spas moved page Text Processing: Grep - recursive search to Text Processing: Recursive search and replace without leaving a redirect)
grep -rni 'string or regexp' *

Where:

  • * – will match to all files and di­rec­to­ries (which doesn't start with ., al­ter­na­tive­ly you may need to use ./ to match every­thing with­in the cur­rent di­rec­to­ry;
  • -r, –re­cur­sive – in this case works to­geth­er with * (or ./);
  • -n – out­put the line num­ber where the match is found,
  • -i, –ig­nore-case – do case in­sen­si­tive match.