[ale] HOW2->automate search/replace text in ALL *.c files in Tree?

Wandered Inn esoteric at denali.atlnet.com
Sun Nov 26 09:15:01 EST 2000


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.





More information about the Ale mailing list