Skip to content

Instantly share code, notes, and snippets.

@ramseyboy
Created November 3, 2016 17:48
Show Gist options
  • Save ramseyboy/8ab0fab65d973b758886992f8c7d1a4d to your computer and use it in GitHub Desktop.
Save ramseyboy/8ab0fab65d973b758886992f8c7d1a4d to your computer and use it in GitHub Desktop.
awk string-array one liner
awk -F/, 'BEGIN{print "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<string-array name=\"food\">"}{print " <item>" $0 "</item>"}END{print "</string-array>\n"}' food.txt > food-array.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment