Shell script using only tail
and sed
to extract lines from an Android xml string resource file
tail -n +6 app/src/main/res/values/changelog.xml | \
sed s'|\\n||g' | \
sed s'|^\ *||' | \
sed -e '/^$/,$d'
This parses a changelog.xml
file, which is used in-app to display release history. The xml file has the usual resource setup, followed by the version names and notes below them:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="changelog">
\n
<A version number, ignored by the script above>:\n
- A line to describe something in this version\n
\n
<another version>:\n
- Things to\n
- describe this\n
- release\n
\n
...
This outputs:
- A line to describe something in this version