Re: [PATCH 1/6] t4061: use POSIX compliance regex(7)
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Mar 19, 2020, 16:01 UTC
- Message-ID
- <CAPig+cRzHtGu2KfjoO4DaPWzDrJOhEQGkgo2Fm7egUPM9m7Vyw@mail.gmail.com>
- In-Reply-To
- <20200319155307.GB3513282@coredump.intra.peff.net>
On Thu, Mar 19, 2020 at 11:53 AM Jeff King <peff@peff.net> wrote:
Show 6 quoted lines
> On Thu, Mar 19, 2020 at 09:00:02PM +0700, Đoàn Trần Công Danh wrote: > > Fix it by using literal `+` instead. > > This makes sense, I think. It could hurt a sed which is expected ERE and > needs the "+" escaped, but I think such a sed would be wrong (and I > imagine would break things elsewhere).
I had the same thought and considered suggesting a character class:
sed -n -e "1,4d" -e "s/^[+]//p" <"$1" >.tmp-1
to make it painfully obvious that "+" is not special in the expression. But then I thought better of it -- for the same reason as you (to wit: such a 'sed' would be wrong) -- and decided against saying anything.