Date: Mon, 9 Feb 2015 11:51:59 -0800 From: Devin Teske <dteske@FreeBSD.org> To: Baptiste Daroussin <bapt@FreeBSD.org> Cc: svn-src-head@freebsd.org, Devin Teske <dteske@FreeBSD.org>, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r278467 - head/usr.sbin/bsdconfig/share Message-ID: <1036F58E-88F8-4058-85AE-B4D2ACA04B81@FreeBSD.org> In-Reply-To: <20150209192440.GL29891@ivaldir.etoilebsd.net> References: <201502091916.t19JGJcO061055@svn.freebsd.org> <20150209192440.GL29891@ivaldir.etoilebsd.net>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <bapt@FreeBSD.org> = 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1036F58E-88F8-4058-85AE-B4D2ACA04B81>