Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

awk printf inside xargs

123 views
Skip to first unread message

giuseppe...@gmail.com

unread,
Jan 7, 2013, 1:01:26 PM1/7/13
to
hi
i'm trying to run multi-core bash script with xargs with an awk command inside.

for dir in UA_tile_txt $(for n in `seq 1 41` 50 ; do echo UA_buf$n"_tile_txt" ; done ) ; do echo $dir ; done | xargs -n 1 -P 16 bash -c $'

dir="$1"

IN_UA=/weldgfs/p51/gius_urban/pop_urban/buffer_tif

cat $IN_UA/$dir/UA_treeh??v??.txt > $IN_UA/$dir/UA_tree_all.txt
cat $IN_UA/$dir/UA_bareh??v??.txt > $IN_UA/$dir/UA_bare_all.txt

awk \'{ printf "%i %i %.4f\n" , $1, $2 , $2 *$3 }\' $IN_UA/$dir/UA_tree_all.txt | sort -k 1,1 -g > $IN_UA/$dir/UA_tree_all_s.txt

' _
exit


the script run without error if i use awk print instead if i use printf it fails.

Probably is due tu the " inside awk. I tried to escape with \" but dose not work.
Could you suggest a solution?
thanks
Giuseppe

giuseppe...@gmail.com

unread,
Jan 7, 2013, 3:52:18 PM1/7/13
to

solved
awk \'{ printf "%i %i %.4f\\n" , $1, $2 , $2 *$3 }\'


0 new messages