Re: in-place editing in awk
- From: James Kanze <james.kanze@xxxxxxxxx>
- Date: Wed, 25 Jun 2008 02:32:02 -0700 (PDT)
On Jun 24, 9:42 am, Dave B <da...@xxxxxxxxxxxx> wrote:
Jeenu wrote:
I'm trying to achieve some thing like this: I've a auto-generated C
header file containing function prototypes. But their respective
definitions are different (only in return type) from that of the
prototype -- something that the compiler would complain about. So I
wanted to modify the header file -- i.e. to correct the return types
-- by finding the definition from .c files.
I've been doing this with the help of grep, sed and a bit of
awk. But as I see it, this involves reading from disk all
the time when ever I've to find a definition. What I hope to
achieve with awk, is that, I read all the required file to a
buffer, and I do an in-memory search- and-replace, and later
write it back to disk, so that I don't need to read the disk
every time I need to find something -- something like the -i
option in sed.
Then do that with sed. What's wrong with
sed -i.bak '...sed code...' file1 file2 file3 .. fileN
This reads and modifies all the files in place, creating .bak
files in case something goes wrong.
Not with standard sed. The only options sed understands are -e,
-f and -n.
--
James Kanze (GABI Software) email:james.kanze@xxxxxxxxx
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
.
- Follow-Ups:
- Re: in-place editing in awk
- From: Dave B
- Re: in-place editing in awk
- References:
- in-place editing in awk
- From: Jeenu
- Re: in-place editing in awk
- From: Dave B
- in-place editing in awk
- Prev by Date: Re: in-place editing in awk
- Next by Date: Re: help me in writing shell script
- Previous by thread: Re: in-place editing in awk
- Next by thread: Re: in-place editing in awk
- Index(es):
Relevant Pages
|