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: Ed Morton
Subject: Re: [bug-gawk] in-place edit request
Date: Mon, 31 Dec 2012 09:03:14 -0600
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/17.0 Thunderbird/17.0

Arnold -

On 12/31/2012 6:48 AM, address@hidden wrote:
Hi Ed.

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.
It would be

        gawk -i inplace 'script' file
That is a significant improvement from what we need to do today. Thank you! Having said that, we then have these options for inplace editing:

    sed -i 'script' file
    perl -i 'script' file
    ruby -i 'script' file
    awk -i inplace 'script' file

I understand from this email exchange that -i is being used by gawk for something else (though I don't see it mentioned at http://www.gnu.org/software/gawk/manual/gawk.html#Options so I'm not sure what) so I assume that -i , unfortunately, is off the table (is it?) but is it really not possible to use "-<capital-i>" or some other single character so we can have:

    sed -i 'script' file
    perl -i 'script' file
    ruby -i 'script' file
    awk -I 'script' file

Right now the chosen implementation is driving the interface. Couldn't we retain that implementation but also provide the interface the users would expect even if it means a little more code internally to map "-I" to the "-i inplace" functionality?


There is nothing stopping anyone from writing a one line wrapper:

        $ cat aip       # Awk In Place
        #! /bin/sh
        exec gawk -i inplace "$@"

Arnold

The goal is to avoid people having to write wrapper scripts for awk when they don't need to for sed, perl, ruby, etc.

To be clear, IMHO providing "-i inplace" is doing 90% of the work to make awk behave like it's peers, it'd just be the icing on the cake if we could get that remaining 10%....

    Ed.



reply via email to

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