Hello,
I am trying to figure out how to do grouping with Sh (similar to awk
'{total+=$2};END {print total}').
This is my Sh script and output :
http://okturing.com/src/12979/body
Any suggestions?
Thanks
% cat gtest
#!/dis/sh
load std csv
nums=()
fn groupcontents {
(fld1 fld2)=$*
echo $fld2
nums=$nums $fld2
echo $nums
}
{
echo a,1
echo b,2
echo c,3
} | getcsv {groupcontents $line }
echo end of file: $nums
% ./gtest
1
1
2
1 2
3
1 2 3
end of file:
%