[geeks] Quick sed question

Greg A. Woods woods at weird.com
Sat Jun 22 13:09:00 CDT 2002


[ On Saturday, June 22, 2002 at 20:40:08 (+1000), Scott Howard wrote: ]
> Subject: Re: [geeks] Quick sed question
>
> On Fri, Jun 21, 2002 at 02:32:14PM -0400, Greg A. Woods wrote:
> > 	# there's a space and a tab in the charset part of this expression:
> > 	sed -e 's/^[ 	]*//'
> 
> Or more efficiently :
> 
> sed -e 's/^[     ]+//'

Good point!  (Though it'll depend entirely on the guts of your regex
compiler and the actual data set.  Your claim is certainly true for at
least the *BSD regex (i.e. the one derived from Henry Spencer's original
implementation).  I don't currently have GNU Sed installed though....)

(I avoid '+' because once upon a time it wasn't portable, i.e. it did
not work on older "sed"s, but it sure as heck can be faster where avail!)

-- 
								Greg A. Woods

+1 416 218-0098;  <gwoods at acm.org>;  <g.a.woods at ieee.org>;  <woods at robohack.ca>
Planix, Inc. <woods at planix.com>; VE3TCP; Secrets of the Weird <woods at weird.com>



More information about the geeks mailing list