---
title: "Find specific text in files recursively"
date: "2010-01-25"
path: "/49-find-specific-text-in-files-recursively.html"
section: "/ramblings"
aliases:
  - "/49"
  - "/49-find-specific-text-in-files-recursively"
  - "/49.html"
  - "/ramblings/49-find-specific-text-in-files-recursively.html"
---

This is a simple one for finding specific text within multiple files:

```
find ./ -type f -name '*.p*' -exec grep -s *115 {} \; -print
```

or to a file:

```
find ./ -type f -name '*.php' -exec grep -s VAT {} \; -print > ~/output.txt
```

Very useful!

### UPDATE

The exec grep command had some flaws, so the same can be achieved using:

```
find ./ -name "*.php" -print0 -type f | xargs -0 grep "addExpressionAttributeToSelect"
```
