[CentOS] find - text

Filipe Brandenburger filbranden at gmail.com
Mon Oct 6 16:50:37 UTC 2008

Well, in your specific case you could replace it only in files that
are *.c or *.h, you can easily use an additional parameter to "find"
to accomplish that:

On Mon, Oct 6, 2008 at 12:34,  <tony.chamberlain at lemko.com> wrote:
>      find . -type f |
>      while read fil
>      do
>          sed -i 's/prog/name/g' $f    # change "prog" to "name"
>      done

Use instead:

find . -type f -name '*.[ch]' | ...

Maybe not what you're looking for, but from your examples that's how I
would approach it.


More information about the CentOS mailing list