Date: Fri, 15 Jan 2010 14:02:18 -0800 From: Garrett Cooper <yanefbsd@gmail.com> To: David Wolfskill <david@catwhisker.org> Cc: FreeBSD-Hackers <hackers@freebsd.org> Subject: Re: User error or awk bug? Message-ID: <7d6fde3d1001151402m74d999e5off14be9a99b5d187@mail.gmail.com> In-Reply-To: <20100115215701.GN86359@bunrab.catwhisker.org> References: <7d6fde3d1001151241tfeaa4a2j1c8448e40b2b164e@mail.gmail.com> <20100115211639.GM86359@bunrab.catwhisker.org> <7d6fde3d1001151351u58ee4989m41d39538469de236@mail.gmail.com> <20100115215701.GN86359@bunrab.catwhisker.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jan 15, 2010 at 1:57 PM, David Wolfskill <david@catwhisker.org> wro= te: > On Fri, Jan 15, 2010 at 01:51:34PM -0800, Garrett Cooper wrote: >> ... >> > >> > d254(6.4-S)[7] echo //////// | awk '{ gsub (/\/{2,}/, ""); print }' >> > //////// >> > d254(6.4-S)[8] echo //////// | awk '{ gsub (/\/+/, "/"); print }' >> > / >> > d254(6.4-S)[9] >> >> =A0 =A0 I'm avoiding this because it would create an infinite loop in my >> awk script (I want to squish slashes, not eliminate them completely >> :)...). > > Errr... =A0I thought "/\/{2,}/" was a regex referring to "2 or more > consecutive /", and the replacement was "", which sounds about as close > to eliminating them completely as I can imagine. =A0:-} > > How about: > > d254(6.4-S)[10] echo //////// | awk '{ gsub (/\/\/+/, "/"); print }' > / > d254(6.4-S)[11] > > then? This works very well. Is the expression quantifier operator [ `{' ] not supported in awk like perl, python, tcl, etc? Thanks, -Garrett
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7d6fde3d1001151402m74d999e5off14be9a99b5d187>