Import Upstream version 20180207
[hcoop/debian/mlton.git] / doc / guide / bin / mk-specialsections-conf.sh
1 #!/bin/sh
2
3 prefix="$2"
4 csplit -f ${prefix} -n 2 -s $1 '%\[specialsections\]%'
5 if [ $(grep '\[[a-z][a-z]*\]' ${prefix}00 | wc -l) -gt 1 ]; then
6 csplit -f ${prefix}00 -n 2 -s ${prefix}00 '%\[specialsections\]%' '/\[[a-z][a-z]*\]/'
7 else
8 cp ${prefix}00 ${prefix}0000
9 fi
10 (cat ${prefix}0000 | sed 's/^\(.*\)=[a-z]\{1,\}$/\1=/') > $2
11 rm ${prefix}00 ${prefix}00[0-9][0-9]