bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] in-place edit request


From: Manuel Collado
Subject: Re: [bug-gawk] in-place edit request
Date: Mon, 31 Dec 2012 11:32:58 +0100
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/17.0 Thunderbird/17.0

El 31/12/2012 8:25, Ed Morton escribió:
Arnold - does the proposed solution allow the user to write:

     gawk -X 'script' file

where "X" is some appropriate letter and the result is to update "file"
with the result of executing "script" on the original contents of "file"?

I just want to make sure we're talking about implementing something every
bit as simple to use as the sed, perl, and ruby equivalents otherwise it's
probably not worth bothering with.

I love simplicity, but there is a risk of oversimplifying. A better approach could be to request in-place edit on a per-file basis. A typical use case is multiple renames. If the set of renames is hardcoded, then the suggested -X syntax is ok:

   gawk -X -f renames.awk file(s)

But if the set of renames is read from a configuration data file, then the proposed syntax is not applicable:

   gawk -X -f renames.awk renames.config file(s)

This invocation will replace both the config file and the file(s) to be edited.

IIRC, Janis proposed a slightly different approach for the general tool:

   inplace command args --- files to_be replaced

The '---' mark separates regular command argument data files from data files to be edited in-place:

   inplace gawk -f renames.awk renames.config --- file(s)

Regards,
--
Manuel Collado - http://lml.ls.fi.upm.es/~mcollado




reply via email to

[Prev in Thread] Current Thread [Next in Thread]