I often have to munge multiple lines together, and I finally found a good way:
echo -e "1\n2" | awk '{ ORS="+"; print; }'
Note that this adds the separator on the end, so I have to handle that:
echo -e "1\n2" | awk '{ ORS="+"; print; }' | awk '{ print $1 "0" }' | bc
No comments:
Post a Comment