From owner-freebsd-questions@freebsd.org Tue Nov 7 19:00:30 2017 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4B99FE62296 for ; Tue, 7 Nov 2017 19:00:30 +0000 (UTC) (envelope-from tundra@tundraware.com) Received: from oceanview.tundraware.com (oceanview.tundraware.com [45.55.60.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mailman.tundraware.com", Issuer "mailman.tundraware.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 0D09080D90 for ; Tue, 7 Nov 2017 19:00:29 +0000 (UTC) (envelope-from tundra@tundraware.com) Received: from [192.168.43.6] (mobile-166-175-58-13.mycingular.net [166.175.58.13]) (authenticated bits=0) by oceanview.tundraware.com (8.15.2/8.15.2) with ESMTPSA id vA7J0FQN075939 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO) for ; Tue, 7 Nov 2017 13:00:19 -0600 (CST) (envelope-from tundra@tundraware.com) Subject: Re: sed - remove nul lines from file References: <88a59a82-2902-9f63-0a94-bd23b910e7ad@gmx.com> <88b1870184a8810072fe503917cd86be.squirrel@webmail.harte-lyne.ca> To: freebsd-questions@freebsd.org From: Tim Daneliuk Message-ID: Date: Tue, 7 Nov 2017 13:00:10 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <88b1870184a8810072fe503917cd86be.squirrel@webmail.harte-lyne.ca> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (oceanview.tundraware.com [45.55.60.57]); Tue, 07 Nov 2017 13:00:20 -0600 (CST) X-TundraWare-MailScanner-Information: Please contact the ISP for more information X-TundraWare-MailScanner-ID: vA7J0FQN075939 X-TundraWare-MailScanner: Found to be clean X-TundraWare-MailScanner-SpamCheck: not spam (whitelisted), SpamAssassin (not cached, score=-0.96, required 1, autolearn=not spam, ALL_TRUSTED -1.00, AWL 0.04) X-TundraWare-MailScanner-From: tundra@tundraware.com X-Spam-Status: No X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Nov 2017 19:00:30 -0000 On 11/07/2017 12:14 PM, James B. Byrne via freebsd-questions wrote: > Sigh. Thank you. That works. However, it also deletes any line that > has even one NUL in it regardless of the presence of other non-nul > characters on the line. Methinks we need a more rigorous statement of reqirements here :) To whit: - A 'line' is something that ends with "\n". - Any line that _only_ contains one or more NULL chars is to be removed entirely. - Any line that contains one or more NULL chars _and_ other chars is to have those NULLs removed, leaving the remainder of the line intact. - An empty line ("\n" only) is to be left untouched. Is that correct? -- ---------------------------------------------------------------------------- Tim Daneliuk tundra@tundraware.com PGP Key: http://www.tundraware.com/PGP/