Code:
for FN in *.out
do H=${FN%%.*}
if [ ! "$H" = "$OH" ]
then OH=$H
{
echo "host,accounts,max,pwd,standard"
echo $H | paste -d, - $H*.out | sed 's/, \+/,/'
} > $H.result
fi
done
---------- host1.result: ----------
host,accounts,max,pwd,standard
host1,root,9,abc pwd=,standard:
,user1,,,user = true
,user2,,,expires = 0
,,,,core_path = on
,,,,default_roles =
---------- host2.result: ----------
host,accounts,max,pwd,standard
host2,root,9,abc pwd=,standard:
,user1,,,user = true
,user2,,,expires = 0
,,,,core_path = on
,,,,default_roles =