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
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!