From owner-svn-src-all@FreeBSD.ORG Mon Feb 9 19:52:15 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4C2B3A5C; Mon, 9 Feb 2015 19:52:15 +0000 (UTC) Received: from shxd.cx (unknown [64.201.244.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 360A664B; Mon, 9 Feb 2015 19:52:15 +0000 (UTC) Received: from 50-196-156-133-static.hfc.comcastbusiness.net ([50.196.156.133]:49341 helo=tinkerbell.pixel8networks.com) by shxd.cx with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.77 (FreeBSD)) (envelope-from ) id 1YKFUF-000C0Z-IS; Sat, 07 Feb 2015 16:12:31 -0800 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.0 \(1990.1\)) Subject: Re: svn commit: r278467 - head/usr.sbin/bsdconfig/share From: Devin Teske In-Reply-To: <20150209192440.GL29891@ivaldir.etoilebsd.net> Date: Mon, 9 Feb 2015 11:51:59 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <1036F58E-88F8-4058-85AE-B4D2ACA04B81@FreeBSD.org> References: <201502091916.t19JGJcO061055@svn.freebsd.org> <20150209192440.GL29891@ivaldir.etoilebsd.net> To: Baptiste Daroussin X-Mailer: Apple Mail (2.1990.1) Sender: devin@shxd.cx Cc: svn-src-head@freebsd.org, Devin Teske , svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Feb 2015 19:52:15 -0000 sed was an odd-man out. awk is used almost 200 times, and sed only once. Consider it the removal of an unnecessary dependency. If there were similar cases of a utility only being used once, I would probably do the same thing (e.g., if =E2=80=9Ctr=E2=80=9D was = used only once, I might convert it to =E2=80=9Cawk=E2=80=9D). I=E2=80=99m very big on minimizing dependencies because I use this stuff in embedded situations. Yeah, the sed binary is smaller=E2=80=A6 but it just didn=E2=80=99t make = much sense to me to use sed only once when awk would do just fine (considering awk is a hard-and-fast dependency with almost 200+ occurrences). =E2=80=94=20 Devin P.S. Sorry for top-posting. > On Feb 9, 2015, at 11:24 AM, Baptiste Daroussin = wrote: >=20 > On Mon, Feb 09, 2015 at 07:16:19PM +0000, Devin Teske wrote: >> Author: dteske >> Date: Mon Feb 9 19:16:19 2015 >> New Revision: 278467 >> URL: https://svnweb.freebsd.org/changeset/base/278467 >>=20 >> Log: >> Replace the only instance of sed(1) in bsdconfig(8) with awk(1). >>=20 >> MFC after: 3 days >>=20 >> Modified: >> head/usr.sbin/bsdconfig/share/keymap.subr >>=20 >> Modified: head/usr.sbin/bsdconfig/share/keymap.subr >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/usr.sbin/bsdconfig/share/keymap.subr Mon Feb 9 = 17:53:16 2015 (r278466) >> +++ head/usr.sbin/bsdconfig/share/keymap.subr Mon Feb 9 = 19:16:19 2015 (r278467) >> @@ -219,7 +219,7 @@ f_keymap_get_all() >> echo -n "$k " >> # NOTE: Translate '8x8' to '8x08' before sending = to >> # sort(1) so that things work out as we might = expect. >> - debug=3D keymap_$k get desc | sed -e = 's/8x8/8x08/g' >> + debug=3D keymap_$k get desc | awk = 'gsub(/8x8/,"8x08")||1' >> done | sort -k2 | awk '{ >> printf "%s%s", (started ? " " : ""), $1; started = =3D 1 >> }' >=20 > Out of curiosity what is the point of preferring awk over sed? the awk = binary > being larger and depending on 2 libraries versus sed only depending on = one? >=20 > Best regards, > Bapt