Mail Archives: djgpp/1999/07/30/14:57:44
| From: | dave AT roborat DOT demon DOT co DOT uk (Dave Scott) | 
| Newsgroups: | comp.os.msdos.djgpp | 
| Subject: | Global file edit? | 
| Date: | Fri, 23 Jul 1999 18:42:16 +0100 (BST) | 
| Organization: | none | 
| Message-ID: | <19990723.1942.13701snz@roborat.demon.co.uk> | 
| X-Trace: | mail2news.demon.co.uk 932756519 mail2news:6845 mail2news mail2news.demon.co.uk | 
| X-Complaints-To: | abuse AT demon DOT net | 
| X-Mail2News-Path: | news.demon.net!tele-post-20.mail.demon.net!roborat.demon.co.uk | 
| X-Newsreader: | SNews 1.30+mods(jlw990606/djgpp) built: Jul 18 1999 | 
| Lines: | 26 | 
| To: | djgpp AT delorie DOT com | 
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp | 
| Reply-To: | djgpp AT delorie DOT com | 
I've just spent several hours getting to grips with sed, find and xargs,
and I realise I'm no closer to being able to do what it was I went
looking for in the first place :-\
Is there a simple utility available to do something like this :-
   edit <existing_string> <replacement_string> <a_bunch_of_filespecs>
Say for instance I wanted to replace all existing calls in a project
to malloc(), with calls to xmalloc() instead...
   "edit malloc xmalloc *.c *.cpp"
which would make the changes in all the affected files, and ideally
retain the original files renamed with .bak extensions (or similar).
The only way I can do anything like that at present is to redirect the
output of a grep into a file, and out of that manually create a batch
file (involving lots of separate calls to sed and rename).
There must be an easier way?
-- 
    ()---()
     (0 0)    Dave Scott   e-mail: dave AT roborat DOT demon DOT co DOT uk
----m-( )-m-------------------------------------------------------------
      =o=
- Raw text -