OK, I will revise to use a variant of this awk line.

Mike

On Dec 4 2013, at 04:28 , Dave Pointon <dpoin...@linux.vnet.ibm.com> wrote:

> Oooops ,
> 
> On Wed, 2013-12-04 at 11:48 +0000, Dave Pointon wrote:
> <snip>
>> 
>> I concur with you Erik, character classes are only proven to work
>> with/in perl 5 across all platforms. I suggest that the need to parse
>> whitespace can be eliminated entirely by using awk(1) with a
>> field-delimiter of '=' thus realizing a simpler solution all together,
>> viz ...
>> 
>> if [[ -z "$OUTPWS" ]]; then
>>    OUTPWS=`awk -F'=' '/^default(-push)/{print $NF}' .hg/hgrc ||
>> $FILTER`
>> fi
>> 
>> 
>> Rgds ,
>> 
> 
> With the benefit of hindsight, the above isn't quite correct since the
> printed value will retain any leading whitespace, so it s/b ...
> 
> if [[ -z "$OUTPWS" ]]; then
> OUTPWS=`awk -F'=' '/^default(-push)?/{sub(/^\t */,'',$NF);print
> $NF}' .hg/hgrc || $FILTER`
> fi
> 
> Note the additional use of sub() to strip leading whitespace from the
> path before printing it.
> 
> Rgds ,
> 
> -- 
> Dave Pointon FIAP MBCS
> 
> Now I saw, tho' too late, the folly of beginning a work before we count
> the cost and before we we judge rightly of our strength to go thro'
> with it - Robinson Crusoe
> 

Reply via email to