From owner-freebsd-questions@FreeBSD.ORG Mon May 10 04:55:02 2010 Return-Path: Delivered-To: freebsd-questions@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1D5B71065672 for ; Mon, 10 May 2010 04:55:02 +0000 (UTC) (envelope-from fbsd1@a1poweruser.com) Received: from mail-03.name-services.com (mail-03.name-services.com [69.64.155.195]) by mx1.freebsd.org (Postfix) with ESMTP id 0537D8FC14 for ; Mon, 10 May 2010 04:55:01 +0000 (UTC) Received: from [10.0.10.3] ([202.69.173.106]) by mail-03.name-services.com with Microsoft SMTPSVC(6.0.3790.3959); Sun, 9 May 2010 21:54:59 -0700 Message-ID: <4BE791A1.80603@a1poweruser.com> Date: Mon, 10 May 2010 12:54:57 +0800 From: Fbsd1 User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: bf1783@gmail.com References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 10 May 2010 04:54:59.0997 (UTC) FILETIME=[F1BCF4D0:01CAEFFC] X-Sender: fbsd1@a1poweruser.com Cc: freebsd-questions@FreeBSD.org Subject: Re: how to find literal in file and them delete that line X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2010 04:55:02 -0000 b. f. wrote: >> Alberto Mijares wrote: snip > > It would make sense if you read the sed(1) and re_format(7) manpages. > They may be a pain at first, but they are used often and can make your > life a lot easier. There are also a lot of tutorial on the web, with > many useful examples, e.g.: > > http://sed.sourceforge.net/grabbag/ > > He is suggesting that, rather than using sh(1), you should use sed(1), > which is typically used for this sort of task, and is also part of the > base system, in some fashion like, for example: > > sed -e '/literal/d' file > > If you insist on doing this with sh(1), which will probably be less > efficient, then you can cobble something together with a 'case' > statement, or parameter expansion with substring processing. See the > sh(1) manpage. > > I hope that you are not intending to use this for a FreeBSD Port in > the context of your earlier message. As someone else has already told > you, ports should _not_ be automatically editing configuration files > like rc.conf. Instead they should just indicate what should be added > by the user or administrator in a pkg-message. Although you are free > to do whatever you want on your own system, if you submit a port that > attempts to tamper with such files to FreeBSD Ports, it is likely that > that part of your submission will be rejected. > Thank you for your kind in-sight. Using sh was again just comments to help explain what I needed help with. A list reader replied offline with examples and now I have what I needed to proceed. Thanks to all who replied.