Skip to content

Instantly share code, notes, and snippets.

@jadbaz
Last active July 17, 2019 13:05
Show Gist options
  • Save jadbaz/de3a8f0ad1419370c32f833ef2f83562 to your computer and use it in GitHub Desktop.
Save jadbaz/de3a8f0ad1419370c32f833ef2f83562 to your computer and use it in GitHub Desktop.
header="<?xml version=\"1.0\" encoding=\"UTF-8\"?><ZenossEvents>"
line="<ZenossEvent><SourceComponent><device>$2</device></SourceComponent><summary>$4 - ###</summary><eventClassKey>GenericErrorKey</eventClassKey><component></component><severity>$3</severity></ZenossEvent>"
footer="</ZenossEvents>"
body=""
for i in `seq 1 $1`; do
this_line=$(echo $line | sed "s/###/$i/g")
body="${body}${this_line}"
done
xml="${header}${body}${footer}"
echo $xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment