From owner-freebsd-questions@FreeBSD.ORG Thu May 28 12:48:46 2009 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 668651065673 for ; Thu, 28 May 2009 12:48:46 +0000 (UTC) (envelope-from invalid.pointer@gmail.com) Received: from mail-px0-f106.google.com (mail-px0-f106.google.com [209.85.216.106]) by mx1.freebsd.org (Postfix) with ESMTP id 37C1B8FC1A for ; Thu, 28 May 2009 12:48:46 +0000 (UTC) (envelope-from invalid.pointer@gmail.com) Received: by pxi4 with SMTP id 4so4544232pxi.3 for ; Thu, 28 May 2009 05:48:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:content-type :content-transfer-encoding; bh=JowF3GJv5iOTnr2E11+ONCj1n8QwTIWljaOAOmg6myk=; b=vddCAEvE6g965DFMEQcxJX5bGoeKVa8b93gMK8UnRzQce9NjTS+SteVJeCaXefa9Mc gJ+oeCFPghp+SwNnqFtFjEy8303aLA/6uLunRiB98ItpaiFHh/SitgLEb9kP7ycD7dA4 mmo90ZLQ7+W1FvV8MXHbTscMC9a3PN659CigA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; b=LOgJgzISB7aCpDqeFwlG5iyfK4vc7FY259X4wCcrWCtqVFpcCd9WDp/1iPHzuB+XnB JS0mvt5Vb6ilbSsshDp0s218At0rZPzLiwhc0+IcpeRpkCKqn/avTMvJavhMc5nzEdTy aCP1zb3EkwGinriXSZHamsLOMDlUrSK+UDWWc= Received: by 10.114.169.12 with SMTP id r12mr1316441wae.68.1243514923600; Thu, 28 May 2009 05:48:43 -0700 (PDT) Received: from ?152.144.218.148? ([203.92.44.179]) by mx.google.com with ESMTPS id v9sm9453576wah.36.2009.05.28.05.48.39 (version=SSLv3 cipher=RC4-MD5); Thu, 28 May 2009 05:48:41 -0700 (PDT) Message-ID: <4A1E8824.1020604@gmail.com> Date: Thu, 28 May 2009 18:18:36 +0530 From: Manish Jain User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: FreeBSD Mailing List Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Roland Smith Subject: Need sed to do something which sounds simple 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: Thu, 28 May 2009 12:48:46 -0000 Hi, I need sed to do something which sounds simple, but I can't figure out the right command. All I need to do is insert a blank after a '}' at the end of a line if the next line begins immediately afterwards (i.e. with no blank line between). //abc.cpp : int myclass::fx(int * arg) { if(! (isValid())) { return -1; } return ptr->fx(arg); } //what-i-want.cpp : int myclass::fx(int * arg) { if(! (isValid())) { return -1; } return ptr->fx(arg); } The commands I have tried are : i) sed -e 's/\(}$\)\n\(^[[:space:]]*[[:alpha:]]\+\)/\1\n\n\2/' \ what-i-want.cpp ii) sed -e 's/\(}$\)\(^[[:space:]]*[[:alpha:]]\+\)/\1\n\2/' \ what-i-want.cpp but obviously neither works, which is why posting this message. Can anybody please tell me what the correct command would be like ? Thank you & -- Regards Manish Jain invalid.pointer@gmail.com +91-96500-10329 Laast year I kudn't spell Software Engineer. Now I are won.