Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Jun 2011 11:24:36 -0400
From:      Lars Kellogg-Stedman <lars@oddbit.com>
To:        Matthew Pounsett <matt@conundrum.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: sed argument processing b0rked?
Message-ID:  <BANLkTik40kE2ds2AvmjykaD3btui1paXkw@mail.gmail.com>
In-Reply-To: <73E783DC-E32B-4DE3-AFF6-4A75D1D3A00A@conundrum.com>
References:  <73E783DC-E32B-4DE3-AFF6-4A75D1D3A00A@conundrum.com>

next in thread | previous in thread | raw e-mail | index | archive | help
>> sed -i'' -e 's/^\(REVOKE ALL ON SCHEMA public FROM \)postgres/\1pgsql/' =
\
> ? =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-e 's/^\(GRANT ALL ON SCHEMA public T=
O \)postgres/\1pgsql/' =C2=A0 =C2=A0\
> ? =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/tmp/pgdump
> sed: -e: No such file or directory

If you put a space after -i:

  sed -i '' ...

It will work.  The '-i' option takes an argument, and if you put a
null argument right next to it, with no spaces, the shell doesn't see
anything there.  That is, this:

  -i''

Is exactly equivalent to this:

  -i

Which means that sed is consuming the following argument as the
extension...so the first '-e' is the argument to the '-i' option.

-- Lars



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BANLkTik40kE2ds2AvmjykaD3btui1paXkw>