
sed : an expression for the last but one line
In article <8oo4mf$ci...@ons.mc2.renault.fr>,
You can negate addresses with the ! command:
$ sed '$!s/:/%/g' /etc/passwd
. That says to match the last line, and then execute the
command shown for every line _except_ that matched line. Getting every line
except the first _and_ the last one is a little trickier; the easiest way I
can think of is
$ sed '1{
p;d
$!s/:/%/g'
, which does the same thing, but first prints the first line
untouched, and then deletes it from the pattern space.
-- Sweth.
--
Sweth Chandramouli ; <sw...@sweth.net>
<a href="http://www.sweth.net/legal/disc.html">*</a>