<p>What GNU/Linux command-line tool would I use for performing a search and replace on a file? </p>

<p>Can the search text, and replacement, be specified in a regex format?</p>

Perl was invented for this:
```
```
perl -pi -e 's/foo/bar/g;' *.txt
```
```
Any normal s/// pattern in those single quotes. You can keep a backup with something like this:
```
```
perl -pi.bak -e 's/foo/bar/g;' *.txt
```
```
Or pipeline:
```
```
cat file.txt | perl -ne 's/foo/bar/g;' | less
```
```
But that's really more sed's job.