Commit a simplification of the script

This commit is contained in:
Laurent Rineau 2012-09-03 12:59:39 +00:00
parent 6ee9b835cd
commit a36aba2d15
1 changed files with 6 additions and 6 deletions

View File

@ -2,18 +2,18 @@
while read -r line
do
pkg=$(echo ${line} | sed -n '/\\package_listing{[^}]*}/p' | sed 's/\\package_listing{\([^}]*\)}/\1/')
pkg=$(echo ${line} | sed -n '/\\package_listing{[^}]*}/ { s/\\package_listing{\([^}]*\)}/\1/; p }')
if [ -n "${pkg}" ]; then
top_level=${pkg%/*}
lower_level=${pkg##*/}
if [ -n "${top_level}" ]; then
cat "../${top_level}/doc/${lower_level}/PackageDescription.txt" | sed -n '/PkgDescriptionBegin/,/PkgDescriptionEnd/p' | \
awk '/\\PkgDescriptionBegin{[^}]*}/ { match($0, "(\\\\PkgDescriptionBegin{)([^}]*)}", a); esc=a[2]; gsub(" ", "-", esc); printf("%s%s,%s}", a[1], a[2], esc); next} {print}'
filename="../${top_level}/doc/${lower_level}/PackageDescription.txt"
else
cat "../${pkg}/doc/${pkg}/PackageDescription.txt" | sed -n '/PkgDescriptionBegin/,/PkgDescriptionEnd/p' | \
awk '/\\PkgDescriptionBegin{[^}]*}/ { match($0, "(\\\\PkgDescriptionBegin{)([^}]*)}", a); esc=a[2]; gsub(" ", "-", esc); printf("%s%s,%s}", a[1], a[2], esc); next} {print}'
filename="../${pkg}/doc/${pkg}/PackageDescription.txt"
fi
sed -n '/PkgDescriptionBegin/,/PkgDescriptionEnd/p' < "$filename" | \
awk '/\\PkgDescriptionBegin{[^}]*}/ { match($0, "(\\\\PkgDescriptionBegin{)([^}]*)}", a); esc=a[2]; gsub(" ", "-", esc); printf("%s%s,%s}", a[1], a[2], esc); next} {print}'
else
echo -E "${line}"
fi
done <$1
done <"$1"