[Tfug] Quick command line question...

brandon brandons.daemon at gmail.com
Wed Mar 10 08:49:16 MST 2010


On Wed, Mar 10, 2010 at 8:41 AM, Jim March <1.jim.march at gmail.com> wrote:

> Folks,
>
> Say I've got a bunch of text files in a directory...all ending with
> .TXT...a dozen or so.
>
> I know that in some, a particular word isn't spelled right - say,
> "regurjitation".  I want to do a command to search for that and
> replace it with "regurgitation" across all files where the bad one is
> found, and save all files to their original names.
>
> Any help appreciated :).
>
> Jim
>
> _______________________________________________
> Tucson Free Unix Group - tfug at tfug.org
> Subscription Options:
> http://www.tfug.org/mailman/listinfo/tfug_tfug.org


Hi Jim-
Not sure what distro you are using but there is a nice perl utility 'rename'
that is on most.

man rename

Then you can do something like this to get an idea of what would happen.
rename -n 's/regurjitation/regurgitation/' *.TXT

Thanks
-Brandon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tfug.org/pipermail/tfug_tfug.org/attachments/20100310/6e48e43e/attachment-0002.html>


More information about the tfug mailing list