[ILUG] [OTish] Regex question...
kevin lyda
kevin at suberic.net
Mon Jan 7 18:57:28 GMT 2002
On Mon, Jan 07, 2002 at 06:11:30PM +0000, Stephen Shirley wrote:
> Ah - well yes it would - but the problem is that i want the regex to
> work for all directories. I.e. I have c files with
>
> #include "foo\bar\apples.h"
> #include "oof\rab\oranges.h"
> #include "ofo\bra\bananas.h"
>
> etc etc, and it would be nice to be able to run just one search-replace,
> but then again it's probably just wishful thinking.
find foo -name '*.c' -exec sh -c "sed '/^#include/{s-\\\\-/-g;}' '{}' > '{}'.tmp ; mv '{}'.tmp '{}'" ';'
replace "foo" with the dir you're using. the above assumes
sh/zsh/ksh/bash style quoting. i've happily forgotten csh quote rules.
make backups. test first. no warrenties. ymmv.
kevin
--
kevin at suberic.net buffy: come on, can't you put your foot down?!
fork()'ed on 37058400 giles: it *is* down.
meatspace place: orbit buffy: one of these days you're going to have to
http://suberic.net/~kevin get a grown up car. --inca mummy girl
More information about the ILUG
mailing list