Skip to content

Instantly share code, notes, and snippets.

@gamefreak
Created October 2, 2009 20:27
Show Gist options
  • Save gamefreak/200090 to your computer and use it in GitHub Desktop.
Save gamefreak/200090 to your computer and use it in GitHub Desktop.
######################################################################
#Copy this into your ares-data/derived/ directory as meatgrinder.sed #
######################################################################
:a
N
$!ba
s/\n/,/g
s|^<\?.*\?>||g
s|^,||g
s|<\([a-z\-]*\)>|\1 = {|g
s|</[a-z\-]*>|}|g
s|<\([a-z\-]*\) integer=\"\(-*[0-9]*\)\"/>|\1 = \2|g
s|<\([a-z\-]*\) real=\"\(-*[0-9\.]*\)\"/>|\1 = \2|g
s|<\([a-z\-]*\) string=\"\([^\"]*\)\"/>|\1 = \"\2\"|g
s|<\([a-z\-]*\)/>|\1 = true|g
s|<\([a-z\-]*\)\ |\1 = {\
|g
s|\([a-z\-]*=\"[^\"]*\"\)\ |\1,|g
s|/>,|}|g
s|>,|,|g
s|[\ ]\{2,\}||g
s|}|},|g
s|,\{1,\}|,|g
s|,}|}|g
s|{,|{|g
s|\-\([^0-9]\)|_\1|g
s|,|,\
|g
s|weapon |weapon1 |
s|weapon |weapon2 |
s|weapon |weapon3 |
s|position\ =\ ||g
#######################################################################
#Then navigate to the ares-data/derived/Objects directory and run this#
# #
#replace $FILE with the file you want to convert. #
#######################################################################
< $FILE sed -f ../meatgrinder.sed | tr '\n' ' ' | sed -e 's|,[^,]*$||'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment