[Swan-dev] sed -e 's/u_int\([^0-9]\)/unsigned\1/g'

D. Hugh Redelmeier hugh at mimosa.com
Thu Sep 6 15:57:35 UTC 2018

| From: Andrew Cagney <andrew.cagney at gmail.com>

| On Wed, 5 Sep 2018 at 23:54, D. Hugh Redelmeier <hugh at mimosa.com> wrote:

| > The pattern /\<u_int\>/ is more reliable and easier.  I'd recommend
| > this:
| >
| >   sed -i -e 's/\<u_int\([0-9]*\)_t\>/uint\1_t/g' -e 's/\<u_int\>/unsigned/g'
| It looks like a gnu extension, or something new to POSIX?

This feature was added to vi, perhaps around 1980.  It seems to be in
most GNU utilities but not in POSIX.

(I'm quite used to it since we at U of T added it to ed and qed
earlier than vi.  It is also in JOVE, the editor I've used since
the mid 1980s.  I could not live without it in egrep and git grep.)

I would not recommend it in scripting because scripts should be

More information about the Swan-dev mailing list