[Tfug] Quick command line question...

Ryan Cresawn jrcresawn at gmail.com
Wed Mar 10 08:51:12 MST 2010


Jim,

Make a backup of the directory before you mangle your data by trying this
bash script. I think it's safe, but it's untested.

for i in *.TXT; do
ed $i<<END
1,$s/regurjitation/regurgitation/g
w
q
END
done

Good luck,
Ryan


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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tfug.org/pipermail/tfug_tfug.org/attachments/20100310/5017636f/attachment-0002.html>


More information about the tfug mailing list