From owner-freebsd-questions@freebsd.org Tue Nov 7 18:34:33 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 E8924E61418 for ; Tue, 7 Nov 2017 18:34:33 +0000 (UTC) (envelope-from jd1008@gmail.com) Received: from mail-it0-x22f.google.com (mail-it0-x22f.google.com [IPv6:2607:f8b0:4001:c0b::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AC4C67EC12 for ; Tue, 7 Nov 2017 18:34:33 +0000 (UTC) (envelope-from jd1008@gmail.com) Received: by mail-it0-x22f.google.com with SMTP id y15so3636809ita.4 for ; Tue, 07 Nov 2017 10:34:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-transfer-encoding; bh=rV2/F/ICTj6Nm38HU2QQkW7iH5ZvPGBWcH/V7WDFdMg=; b=RjiRjHl8tuQPP0awNq9N94oYFAVpblqj8VPX5P3BLOzoAUsGo35B6lm7jwBV7FjvN3 qev6aqK8n0ltr8PcOMcBSkKL6V5bvFyaKrRmMTG04GNRHm5ohd6OOqc1HGc52oDtxtM5 JywnQxZAXh09uJYIu9OYUvTDiT3GMyWmTXLLmm+6Ugv/H9O543KAffy18IaUKqkZk8bE 1cvkByc/grqUf+bUYocgbRPnhUoho+CwmsJL7oUqtjzmfTm8tElNdeojhYpHkzil+HgW IW/3pMtCUgUQ2dL4dTUuwn8N0Kwa+14gljCNFkjXgz7j4oHR/MiSgBoESN+YSZ5yGLcV zb9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-transfer-encoding; bh=rV2/F/ICTj6Nm38HU2QQkW7iH5ZvPGBWcH/V7WDFdMg=; b=I9X66CBBSQV1rzubecXkf4bc6WHWFGSVoCRYTfTfBl5cUtrgQwDZmJPfPsA1EvjsOP BuoLnuNjCdoOzf/hM/6vvtefcVTenfpGOGlayUSir3CZyh0+9Wob6iaEkTqc+pnnzuWU /4s6OGRL/KqIg/kKXMhR2aJbNr/cQ6/vvCW4KiCWYJsVdkm7UAEU2fCNXUXb3PQcGkyv v+Nh2oZY6aopohWASr3We9k40qTgdMHWVpYrme6l9C+1UYqceRj5Ar8V0kCv1Avfeekq kfeDz1wBjOhx+oqkpMzECJ0ztgwb4HIKzdvCvmOhvyrdKaphQCoUcciItzGpWRBnjiMh x2JA== X-Gm-Message-State: AJaThX5/o2Ydo7bvJw4fxBPGsRgokHUOjrdQiZ7NFpiKOM/KmYQD5OTJ S4+rhh5tTpY9rQlg9dAesI5w8g== X-Google-Smtp-Source: ABhQp+Q76wKrGNg4Vazcvv2D7dKCDJ9kOYK34FfaMWUvu4jg84x2WHGRHjtE7PtH2Llc2Vj/2Fj89g== X-Received: by 10.36.60.86 with SMTP id m83mr160993ita.25.1510079672862; Tue, 07 Nov 2017 10:34:32 -0800 (PST) Received: from localhost.localdomain (50-243-4-3-static.hfc.comcastbusiness.net. [50.243.4.3]) by smtp.googlemail.com with ESMTPSA id b133sm868232ioe.73.2017.11.07.10.34.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Nov 2017 10:34:32 -0800 (PST) Message-ID: <5A01FCB7.9070201@gmail.com> Date: Tue, 07 Nov 2017 11:34:31 -0700 From: JD User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: freebsd-questions@freebsd.org Subject: Re: sed - remove nul lines from file References: In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit 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 18:34:34 -0000 On 11/07/2017 11:05 AM, James B. Byrne via freebsd-questions wrote: > On Tue, November 7, 2017 12:46, Tim Daneliuk wrote: >> On 11/07/2017 11:12 AM, James B. Byrne via freebsd-questions wrote: >>> I have a data file created by an ancient proprietary scripting >>> language called QTP. There is a bug in this program which, on >>> occasion, manifests itself by inserting output records consisting >>> entirely of nul (^@) (\x00) bytes at regular intervals. In the >>> present case every 47th. record consists entirely of nuls. >> >> >> I don't have the magic off the top of my head, but this might be a >> good job for 'tr'... > I have not found a way to get tr to actually delete the lines. > Getting rid of all the nul characters I can do using three different > ways that I know of. What I want to get rid of is the entire line. > What version of linux r u using. I have a few fedora machines from F20 to current f27 on all of them, tr -d works just fine. To wit: $ cat -v /tmp/x ################################################ ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^ $ tr -d '\000' < /tmp/x > /tmp/x2 $ cat -v /tmp/x2 ################################################