Re: expansion of \uXXXX in non utf8 locales

2012-12-21 Thread Chet Ramey
On 12/20/12 9:00 PM, Stephane Chazelas wrote:

> Bash Version: 4.2
> Patch Level: 36 (same with 39)
> Release Status: release
> 
> Description:
>   There seems to be a bug with the expansion of \u
>   where  > 0xFF in non UTF8 locales

Yes, bash-4.2 doesn't do good enough error checking on the return value
from wctomb.  This will be fixed in the next release; the new code has been
in the development branch for some time.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



Re: xargs combined with awk

2012-12-21 Thread giuseppe . amatulli
thanks to all of you.
in the end i selected 
the following solution

-c $'    awk  \'{}\'  '

all the best
giuseppe

On Thursday, 20 December 2012 09:43:50 UTC-6, giuseppe...@gmail.com  wrote:
> Hi,
> 
> have this a for loop which is sending the "dir" variable one for each 
> processor.
> 
> 
> 
> 
> 
> for dir in UA_tile_tif_pop_txt UA_buf10_tile_tif_pop_txt 
> UA_buf20_tile_tif_pop_txt UA_buf30_tile_tif_pop_txt UA_buf40_tile_tif_pop_txt 
> UA_buf50_tile_tif_pop_txt ; do echo $dir ; done | xargs  -n 1 -P 6 bash -c '
> 
> IN_UA=/weldgfs/p51/gius_urban/pop_urban/buffer_tif
> 
> dir="$1"
> 
> 
> 
> join -1 2  -2 1 $IN_UA/$dir/UA_block_sum_s.txt 
> $IN_UA/$dir/UA_popD_all.txt   > $IN_UA/$dir/UA_block_sum_popD.txt
> 
> join -1 2  -2 1 $IN_UA/$dir/UA_block_sum_popD.txt  
> $IN_UA/$dir/UA_hunitD_all.txt > $IN_UA/$dir/UA_block_sum_popD_hunitD.txt
> 
> 
> 
> ' _ 
> 
> 
> 
> The loop works fine, no issues. 
> 
> When i'm insert an awk command in the -c ' ' _ 
> 
> I get an error. 
> 
> 
> 
> e.g. 
> 
> 
> 
> 
> 
> for dir in UA_tile_tif_pop_txt UA_buf10_tile_tif_pop_txt 
> UA_buf20_tile_tif_pop_txt UA_buf30_tile_tif_pop_txt UA_buf40_tile_tif_pop_txt 
> UA_buf50_tile_tif_pop_txt ; do echo $dir ; done | xargs  -n 1 -P 6 bash -c '
> 
> IN_UA=/weldgfs/p51/gius_urban/pop_urban/buffer_tif
> 
> dir="$1"
> 
> 
> 
> awk '{ print $2 }' $IN_UA/$dir/UA_block_sum_s.txt  > $IN_UA/$dir/test.txt
> 
> 
> 
> ' _
> 
> 
> 
> 
> 
> awk: cmd. line:1: {
> 
> awk: cmd. line:1:  ^ unexpected newline or end of string
> 
> 
> 
> 
> 
> I try to escape with the \ the ' and the } but no good results.
> 
> any idea how how i can insert awk function in xargs bash -c '  '_ syntax?
> 
> 
> 
> I would like to avoid to create an external script and called it by 
> 
> xargs bash myscript.sh 
> 
> 
> 
> thanks in advance 
> 
> Giuseppe