Skip to content

Instantly share code, notes, and snippets.

@akovac35
Last active September 4, 2020 08:17
Show Gist options
  • Save akovac35/07ea9cf03036a2a4119b8ece9f8decdd to your computer and use it in GitHub Desktop.
Save akovac35/07ea9cf03036a2a4119b8ece9f8decdd to your computer and use it in GitHub Desktop.
This bash script will increase the last digit of all csproj files within the current solution folder which contain version element.
# Authors
# Aleksander Kovač https://github.com/akovac35
#
# This bash script will increase the last digit of all csproj files within the current
# solution folder which contain version element.
while read -r line ; do
echo "Processing $line"
# Need to use intermediate file because of perl locks
cp $line{,.bak}
(perl -pe 's/^(\s*<Version>)((\d+\.)*)(\d+)(.*)$/$1.$2.($4+1).$5/e' < $line.bak) > $line
rm $line.bak
done < <(grep -ril --include \*.csproj -E "<Version>.+</Version>" ./)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment