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: ebl...@redhat.com
To: dale.vis...@live.com; autoconf@gnu.org
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@gnu.org
https://lists.gnu.org/mailman/listinfo/autoconf

Reply via email to