From owner-freebsd-questions@FreeBSD.ORG Mon May 18 13:31:50 2015 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1694FF5D for ; Mon, 18 May 2015 13:31:50 +0000 (UTC) Received: from smtp.infracaninophile.co.uk (smtp6.infracaninophile.co.uk [IPv6:2001:8b0:151:1:3cd3:cd67:fafa:3d78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.infracaninophile.co.uk", Issuer "ca.infracaninophile.co.uk" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 9A4BF18F1 for ; Mon, 18 May 2015 13:31:49 +0000 (UTC) Received: from zero-gravitas.local (no-reverse-dns.metronet-uk.com [85.199.232.226] (may be forged)) (authenticated bits=0) by smtp.infracaninophile.co.uk (8.15.1/8.15.1) with ESMTPSA id t4IDVhPX023524 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO) for ; Mon, 18 May 2015 14:31:44 +0100 (BST) (envelope-from matthew@FreeBSD.org) Authentication-Results: smtp.infracaninophile.co.uk; dmarc=none header.from=FreeBSD.org DKIM-Filter: OpenDKIM Filter v2.9.2 smtp.infracaninophile.co.uk t4IDVhPX023524 Authentication-Results: smtp.infracaninophile.co.uk/t4IDVhPX023524; dkim=none reason="no signature"; dkim-adsp=none; dkim-atps=neutral X-Authentication-Warning: lucid-nonsense.infracaninophile.co.uk: Host no-reverse-dns.metronet-uk.com [85.199.232.226] (may be forged) claimed to be zero-gravitas.local Message-ID: <5559E9A4.409@FreeBSD.org> Date: Mon, 18 May 2015 14:31:16 +0100 From: Matthew Seaman User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: freebsd-questions@freebsd.org Subject: Re: Problem with sed References: <20150518090051.6600f32a@seibercom.net> In-Reply-To: <20150518090051.6600f32a@seibercom.net> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="O9NjIEtDsh0W6bh16nqJxlwAe9qsFkQ3c" X-Virus-Scanned: clamav-milter 0.98.7 at lucid-nonsense.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, score=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on lucid-nonsense.infracaninophile.co.uk X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 May 2015 13:31:50 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --O9NjIEtDsh0W6bh16nqJxlwAe9qsFkQ3c Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2015/05/18 14:00, Jerry wrote: > I rarely use sed, so I admit to not being fully acquainted with its > idiosyncrasies,; however, this one is really annoying. >=20 > I am using this command in an attempt to remove empty lines: >=20 > $ sed -i /^$/d /var/tmp/myfile.txt >=20 > and get this error: >=20 > sed: 1: "/var/tmp/myfile.txt": undefined label 'mp/myfile.txt' >=20 > I don't understand why. I am following the example I found in the "sed = & awk" handbook by "O'Reilly" >=20 sed -i.bak -e '/^$/d' /var/tmp/myfile.txt You're getting sed(1) confused as to what is the extension for the backup of the file it creates, what the command you want to rn is and what the input filename is. Also, you need to put some characters of syntactic significance to the shell inside quote marks. Cheers, Matthew --O9NjIEtDsh0W6bh16nqJxlwAe9qsFkQ3c Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.22 (Darwin) Comment: GPGTools - https://gpgtools.org iQJ8BAEBCgBmBQJVWem0XxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQxOUYxNTRFQ0JGMTEyRTUwNTQ0RTNGMzAw MDUxM0YxMEUwQTlFNEU3AAoJEABRPxDgqeTnJXQP/RykQUGX/Ri0tv7Zh02gZomB lE4jSJeGZ8rNxSwUU3jMdAOMzupvUa7kFXCc4n+4mdqmD18yMkDsjml/La/9qiC4 pnWxkf/dfq4L5eCPedLsjMAR6Xq8OMFeqTdpAG0yinEG4UkETOq3LT7cWjkqrqiR qBI+pouyx8ESZvL1enYM2eK3IhZgXS253RyRgeNPzA7ct36JRKH7BSGDoLfPl+VI roFmSM4GQUym00FrbRw4lwA80/MSB6sqfrh3OKSNy+P//1SogTrJmomTKUXlG2fO Jpsq/VYzgNLx7UU1UsjUBdrNGg2DnyNBKbNTUkfB3bt+OAuUz6WbgZK2lMCKSXPZ DBMVHHMkQUyt/ZKfTAmJYzK90oe8Mu5zhpUuNHW7kLC46Zdp4KAeajQRl0Ay02z7 mu88sC690+Wpzfpzx5ZZwxcVjE8fFnV342pzQQ/O1ERzhUW0dlCgfaRFjInkNSEq TUQIWAZvNPRnIdicNf6yzG5iepE5KuE+cLlODZmbTo2BmQwyoKsQ8FbWGD0Tckg2 w4RD/q4G7wnDzf9MZZ+AXYWls3NIFSMZvpvtoiELVwmYnJCEx30GHY6TZZ/ylDd3 7lBQK2BGWAlUE+uzGXs5p3YODwXtFYpE5U3Qxxz7ZiTMXYLyvIfxBXERDpZL/OQq PFZqiC6bdAye2IbPcDG8 =ZpAW -----END PGP SIGNATURE----- --O9NjIEtDsh0W6bh16nqJxlwAe9qsFkQ3c--