aide...@gentoo.org: > From: Amadeusz Żołnowski <aide...@gentoo.org> > > awk doesn't have the -i option like sed and if editing file in place is > desired, additional steps are required. eawk uses tmp file to make it > look to the caller editing happens in place. > --- > eclass/eutils.eclass | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass > index dbedffe..e331f1b 100644 > --- a/eclass/eutils.eclass > +++ b/eclass/eutils.eclass > @@ -20,6 +20,19 @@ _EUTILS_ECLASS=1 > > inherit multilib toolchain-funcs > > +# @FUNCTION: eawk > +# @USAGE: <file> <args> > +# @DESCRIPTION: > +# Edit file <file> in place with awk. Pass all arguments following <file> to > +# awk. > +eawk() { > + local f="$1"; shift > + local tmpf="$(emktemp)" > + > + cat "${f}" >"${tmpf}" || return 1 Why shell redirection with cat instead of cp? both are in coreutils. Also, wouldn't the absence of 'die' cause silent breakages?
> + awk "$@" "${tmpf}" >"${f}" > +} > + > # @FUNCTION: eqawarn > # @USAGE: [message] > # @DESCRIPTION: >