File pre_checkin.sh of Package python3
#!/bin/bash
# This script is called automatically during autobuild checkin.
master=python3-base.spec
slaves=python3.spec
sections="COMMON-PATCH COMMON-DEF COMMON-PREP"
for slave in $slaves; do # yes, you are right. we don't need the 'for'. but as long as it's there, why not keep it
{
prev=1
for section in $sections; do
begin="/$section-BEGIN/"
end="/$section-END/"
sed -n -e "${prev},${begin}p" $slave
sed -n -e "${begin},${end}p" $master | head -n -1 | tail -n +2
prev=$end
done
sed -n -e "${prev},\$p" $slave
} > $slave.tmp && mv $slave.tmp $slave
done