[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] HOW2->automate search/replace text in ALL *.c files in Tree?
- Subject: [ale] HOW2->automate search/replace text in ALL *.c files in Tree?
- From: esoteric at denali.atlnet.com (Wandered Inn)
- Date: Sun, 26 Nov 2000 09:15:01 -0500
Courtney Thomas wrote:
>
> Happy Holidays !
>
> I know how to do a find/replace in a single file using Xemacs but not
> how to do a find/replace on all files in a Tree ? Any help here ?
>
> Also, perl is available, but I'd prefer a xemacs answer as I plan on
> this environment, unless there's a better environment. How 'bout it ?
Not emacs, but it works:
for fn in $(find . -name '*.c' -print); do
sed 's/FIND_THIS/CHANGE_TO_THIS/g' $fn > /tmp/$fn
# note, original file is left if /tmp (backup)
cp /tmp/$fn $fn
done
--
Until later: Geoffrey esoteric at denali.atlnet.com
"Great spirits have always found violent opposition from mediocre minds.
The
latter cannot understand it when a man does not thoughtlessly submit to
hereditary prejudices but honestly and courageously uses his
intelligence."
- Albert Einstein
--
To unsubscribe: mail majordomo at ale.org with "unsubscribe ale" in message body.