Skip to content

Instantly share code, notes, and snippets.

@jasonm23
Created May 16, 2010 01:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonm23/402550 to your computer and use it in GitHub Desktop.
Save jasonm23/402550 to your computer and use it in GitHub Desktop.
grep '<eventImage' config_en.xml | sed -e 's/[^\=]*\="\([0-9]*\)" value\="\([^.]*\)\.png"\/>/\1 \2/' | cat -n | wra b c; do echo "INSERT INTO event_type_numbers VALUES($a, '$b', '$(ds)', '$(ds)', 1, $(grep $c types.txt | sed 's/\([0-9]*\).*/\1/'));"; done
# find <eventImage nodes and grab their name value pairs, add line numbers, while read and split into a, b, c, (alias wra) then create a sql insert, $(ds) is a datestamp alias, then define the last column by searching for the image name in a list called types, and insert the associated ID num. and done.
@jasonm23
Copy link
Author

Use pup or some other cmdline dom parser if you have to stay in the shell.

@jasonm23
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment