Skip to content

Instantly share code, notes, and snippets.

@Great-Antique
Created March 6, 2014 14:02
Show Gist options
  • Save Great-Antique/9390356 to your computer and use it in GitHub Desktop.
Save Great-Antique/9390356 to your computer and use it in GitHub Desktop.
Parse svn authors file for git manipulation like filter-branch
#!/usr/bin/env bash
authorsFile='/path/to/svn.authors'
declare -A authorsArray
IFS=$'\n' authorsStrAll=($(cat $authorsFile))
for authorStr in ${authorsStrAll[@]}
do
echo $authorStr
IFS='=' authorsStrArray=($authorStr)
authorNick=$(echo ${authorsStrArray[0]} | sed -e 's/^ *//' -e 's/ *$//')
authorsArray[$authorNick][nick]=$authorNick
echo $authorNick
IFS=' ' authorsStrArray=(${authorsStrArray[1]})
authorName=$(echo ${authorsStrArray[@]:0:2} | sed -e 's/^ *//' -e 's/ *$//')
authorsArray[$authorNick][name]=$authorNick
echo $authorName
authorEmail=$(echo ${authorsStrArray[2]} | sed -e 's/^ *//' -e 's/ *$//' -e 's/^<*//' -e 's/>*$//')
authorsArray[$authorNick][email]=$authorNick
echo $authorEmail
echo '-------------'
done
# use authorsArray
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment