R
RjY
Summary: The "flip-flop" sed/awk-style range operator includes its end
points. I would like to know if there's a way to make it not do that.
To illustrate[1], suppose I have a file like this:
blah
START
bleourgh
END
fleurgh
then feeding it into perl -ne 'print if /START/../END/;' gives
START
bleourgh
END
What I would like is a range operator suitable for shell one-liners that
does the same but is false on the endpoints rather than true, so that
the above example would not include the endpoints and so simply print
"bleourgh".
Is there a short idiom for this that I have simply missed? It seems not
to be too exotic a use-case. I tried using ... instead of .. but it had
no effect (obviously I misunderstood the difference)
[1] for the mathematically inclined: the range operator works more like
a closed interval; I would like it to work like an open one.
points. I would like to know if there's a way to make it not do that.
To illustrate[1], suppose I have a file like this:
blah
START
bleourgh
END
fleurgh
then feeding it into perl -ne 'print if /START/../END/;' gives
START
bleourgh
END
What I would like is a range operator suitable for shell one-liners that
does the same but is false on the endpoints rather than true, so that
the above example would not include the endpoints and so simply print
"bleourgh".
Is there a short idiom for this that I have simply missed? It seems not
to be too exotic a use-case. I tried using ... instead of .. but it had
no effect (obviously I misunderstood the difference)
[1] for the mathematically inclined: the range operator works more like
a closed interval; I would like it to work like an open one.