Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Mar 2002 20:02:22 -0700
From:      Zach Thompson <cublai@lastamericanempire.com>
To:        ekoz <ekoz@melsa.net.id>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: perl question
Message-ID:  <20020318200222.A6691@lastamericanempire.com>
In-Reply-To: <001c01c1cee9$54b626d0$d4e18aca@melsa.net.id>; from ekoz@melsa.net.id on Tue, Mar 19, 2002 at 08:56:47AM %2B0700
References:  <001c01c1cee9$54b626d0$d4e18aca@melsa.net.id>

next in thread | previous in thread | raw e-mail | index | archive | help
* ekoz <ekoz@melsa.net.id> [020318 19:07]:
> Hi All,
> 
> I have a little problem with perl. I try to delete a few line in a file with perl. I have a following line :
> 
> cs
> cs.tpkkoja
> 
> I use "s/\bcs\b/ /;" to deleting the word "cs" and i don't want to deleting  "cs.tpkkoja" but, i get this result :
> 
>      .tpkkoja
> all the word "cs" is deleted include in "cs.tpkkoja".
> Any Suggestions ?

If the "cs" you want to delete is always on a line of itself:

s/^cs$//;

You could add other things like checking for leading/trailing whitespace
too.

Zach Thompson

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




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