Complex (?) Unix Text Replace Command

Posted by Matrym on Super User See other posts from Super User or by Matrym
Published on 2011-02-14T03:40:11Z Indexed on 2013/10/24 15:59 UTC
Read the original article Hit count: 214

What's the command line equivalent of: For every file that contains "AAA" within its contents, find "BBB" and replace it with "CCC"

Thus, the command would match and replace BBB in a file:

<html>
<head></head>
<body>
AAA
Hello world!
BBB    
</body>
</html>

But Not in a file:

<html>
<head></head>
<body>
Don't match me!
BBB    
</body>
</html>

Thanks in advance!

© Super User or respective owner

Related posts about command-line

Related posts about unix