From owner-freebsd-questions@FreeBSD.ORG Thu Feb 2 06:22:42 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D2C1106566C for ; Thu, 2 Feb 2012 06:22:42 +0000 (UTC) (envelope-from guru@unixarea.de) Received: from ms16-1.1blu.de (ms16-1.1blu.de [89.202.0.34]) by mx1.freebsd.org (Postfix) with ESMTP id BD6838FC14 for ; Thu, 2 Feb 2012 06:22:40 +0000 (UTC) Received: from [93.104.66.101] (helo=localhost.my.domain) by ms16-1.1blu.de with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1Rsq47-0003T0-FZ for freebsd-questions@freebsd.org; Thu, 02 Feb 2012 07:22:39 +0100 Received: from localhost.my.domain (localhost [127.0.0.1]) by localhost.my.domain (8.14.4/8.14.3) with ESMTP id q126MbbO003446 for ; Thu, 2 Feb 2012 07:22:38 +0100 (CET) (envelope-from guru@unixarea.de) Received: (from guru@localhost) by localhost.my.domain (8.14.4/8.14.3/Submit) id q126Mb91003445 for freebsd-questions@freebsd.org; Thu, 2 Feb 2012 07:22:37 +0100 (CET) (envelope-from guru@unixarea.de) X-Authentication-Warning: localhost.my.domain: guru set sender to guru@unixarea.de using -f Date: Thu, 2 Feb 2012 07:22:36 +0100 From: Matthias Apitz To: freebsd-questions@freebsd.org Message-ID: <20120202062236.GA3419@tinyCurrent> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Operating-System: FreeBSD 9.0-CURRENT r214444 (i386) User-Agent: Mutt/1.5.21 (2010-09-15) X-Con-Id: 51246 X-Con-U: 0-guru X-Originating-IP: 93.104.66.101 Subject: some kind of binary sed(1) command X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Matthias Apitz List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Feb 2012 06:22:42 -0000 Hello, I have a normal ASCII file wich has in some places two lines of '*', separated by an empty line, i.e. ....\n *********************\n \n *********************\n ....\n and I want to substitute the \n between the star lines by \f; the 'binary' sed command would just be s/*****\n\n*****/*****\n\f*****/ which ofc does not work with sed(1) because it is line oriented; I could write something in perl, C, awk or whatever language, but I would prefer to do it with the normal commands... any ideas? Thanks matthias -- Matthias Apitz t +49-89-61308 351 - f +49-89-61308 399 - m +49-170-4527211 e - w http://www.unixarea.de/ UNIX since V7 on PDP-11 | UNIX on mainframe since ESER 1055 (IBM /370) UNIX on x86 since SVR4.2 UnixWare 2.1.2 | FreeBSD since 2.2.5