[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Use m4 to change a file in-place
From: |
Bob Proulx |
Subject: |
Re: Use m4 to change a file in-place |
Date: |
Wed, 13 Apr 2016 00:59:19 -0600 |
User-agent: |
Mutt/1.5.24 (2015-08-30) |
Peng Yu wrote:
> Hi, sed has an option `--in-place` to allow the change to a file
> in-place. But I don't find a similar option in m4. Does anybody know
> there is a similar option that I can use for in-place modification of
> a file? Thanks.
There are many, many commands out there that would all need to be
changed if you want to modify each and every one of them for in place
editing. Better to use a filter program to centralize the code. Such
as 'sponge' from the moreutils package. Then it will work with any
filter.
http://joeyh.name/code/moreutils/
With 'sponge' you can do things like this:
sed '...' file | grep '...' | sponge file
Bob