RE: Recommended way to truncate a shell variable value in autoconf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Eric:

My experience with expr just prior was that it was matching too greedily on the character class. I had just assumed I would need two steps with sed, too. However, I checked and your suggestion works as I need it to.

I think the difference is that in expr, one specifies what part of the expression match to keep. The sed command is specifying what to replace, so in that case greedy matching worked in my favor.

Thank you!
Dale

--
Date: Fri, 21 Feb 2014 17:09:28 -0700
From: eblake@xxxxxxxxxx
To: dale.visser@xxxxxxxx; autoconf@xxxxxxx
Subject: Re: Recommended way to truncate a shell variable value in autoconf


> X=`echo "$X" | sed 's/ .*// ' | sed 's/,.*//'`
 
sed|sed is a waste of a fork.  Just go with:
 
X=`echo "$X" | sed 's/[, ].*//'`
 		 	   		  
_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
https://lists.gnu.org/mailman/listinfo/autoconf




[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux