Your message dated Thu, 24 Feb 2005 20:26:05 -0500
with message-id <[EMAIL PROTECTED]>
and subject line Bug#296792: sed: s/^#*lock$/#lock/2 replaces nothing while 
s/^#*lock$/#lock/ replaces every occourence
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 24 Feb 2005 18:02:25 +0000
>From [EMAIL PROTECTED] Thu Feb 24 10:02:25 2005
Return-path: <[EMAIL PROTECTED]>
Received: from basket.ball.reliam.net [213.91.6.7] 
        by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
        id 1D4NJh-0007jx-00; Thu, 24 Feb 2005 10:02:25 -0800
Received: from pit.ID-43118.user.dfncis.de (pD9E6A968.dip0.t-ipconnect.de 
[217.230.169.104])
        by basket.ball.reliam.net (Postfix) with ESMTP id 6CC4C3D81
        for <[EMAIL PROTECTED]>; Thu, 24 Feb 2005 19:01:54 +0100 (CET)
Received: from grfz by pit.ID-43118.user.dfncis.de with local (Exim 3.36 #1 
(Debian))
        id 1D4NJB-0006Rx-00
        for <[EMAIL PROTECTED]>; Thu, 24 Feb 2005 19:01:53 +0100
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
From: Gregor Zattler <[EMAIL PROTECTED]>
To: Debian Bug Tracking System <[EMAIL PROTECTED]>
Subject: sed: s/^#*lock$/#lock/2 replaces nothing while s/^#*lock$/#lock/ 
replaces
 every occourence
Reply-To: Gregor Zattler <[EMAIL PROTECTED]>
X-Mailer: reportbug 3.8
Date: Thu, 24 Feb 2005 19:01:53 +0100
Message-Id: <[EMAIL PROTECTED]>
Delivered-To: [EMAIL PROTECTED]
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 
        (1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-8.0 required=4.0 tests=BAYES_00,HAS_PACKAGE 
        autolearn=no version=2.60-bugs.debian.org_2005_01_02
X-Spam-Level: 

Package: sed
Version: 4.1.4-2
Severity: normal

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I want to stream edit grub's menu.lst.  I want to unlock one
specific entry in menu.lst.  This file contains several lines
whitch match "^lock$" (according to grep).

According to sed's info file the s(ubstitute) command accepts an
optional flag "number" which determines to substitute only the
"number'th" occourence of the pattern.

But with tis command line:
/bin/sed -e "s/^#*lock/#lock/2" /boot/grub/menu.lst >/tmp/nuk
nothing gets substituted,

Wheareas with:
/bin/sed -e "s/^#*lock/#lock/g" /boot/grub/menu.lst >/tmp/nuk
every occurence of "^lock$" gets substituted.  This is correct. 
But:
/bin/sed -e "s/^#*lock/#lock/" /boot/grub/menu.lst >/tmp/nuk
also substitutes ever occurence of "^lock$".  Shouldn't it only
substitute the first occurence?

Thnis is very easy testable with a file like this:
lock
lock
lock
lock
lock
lock
lock
lock
lock
lock
lock
lock
lock
lock
lock
lock
lock


Perhaps related:

I use reportbug (1) to report this bug.  First it scans the
installation of the package in question.  in this case it gave
the following output:

> Getting status for sed...
> Verifying package integrity...
> There may be a problem with your installation of sed;
> the following files appear to be missing or changed:
> 
> Do you still want to file a report [y|N|q|?]?

But there is no file displayed.  I reinstalled sed and started
reportbug again:  Same message.

I attach my menu.lst

- -- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.10-grsec
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15)

Versions of packages sed depends on:
ii  libc6                       2.3.2.ds1-20 GNU C Library: Shared libraries an

- -- no debconf information

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFCHhaR8uuCWtJTB8oRAlNwAJ46ZFP9NXc3MZxAfrGU6FK9D0wsPwCfcI/A
V7cRSIWZkYxyj3Ab+e5GqgU=
=C2sJ
-----END PGP SIGNATURE-----

---------------------------------------
Received: (at 296792-done) by bugs.debian.org; 25 Feb 2005 01:26:06 +0000
>From [EMAIL PROTECTED] Thu Feb 24 17:26:06 2005
Return-path: <[EMAIL PROTECTED]>
Received: from acolyte.scowler.net [216.254.112.45] 
        by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
        id 1D4UF4-0004cn-00; Thu, 24 Feb 2005 17:26:06 -0800
Received: by acolyte.scowler.net (Postfix, from userid 1000)
        id 7B3937004D; Thu, 24 Feb 2005 20:26:05 -0500 (EST)
Date: Thu, 24 Feb 2005 20:26:05 -0500
From: Clint Adams <[EMAIL PROTECTED]>
To: Gregor Zattler <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
Subject: Re: Bug#296792: sed: s/^#*lock$/#lock/2 replaces nothing while 
s/^#*lock$/#lock/ replaces every occourence
Message-ID: <[EMAIL PROTECTED]>
References: <[EMAIL PROTECTED]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <[EMAIL PROTECTED]>
User-Agent: Mutt/1.5.6+20040907i
Delivered-To: [EMAIL PROTECTED]
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 
        (1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-6.0 required=4.0 tests=BAYES_00,HAS_BUG_NUMBER 
        autolearn=no version=2.60-bugs.debian.org_2005_01_02
X-Spam-Level: 

> But with tis command line:
> /bin/sed -e "s/^#*lock/#lock/2" /boot/grub/menu.lst >/tmp/nuk
> nothing gets substituted,
> 
> But:
> /bin/sed -e "s/^#*lock/#lock/" /boot/grub/menu.lst >/tmp/nuk
> also substitutes ever occurence of "^lock$".  Shouldn't it only
> substitute the first occurence?

You misunderstand.  /2 is not the second occurrence in the file, /2 is
the second occurrence in each line.

Similarly, without the /2 it is the first occurrence in each line, and
with /g it is every occurrence in every line.

What you want to do is something different.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to