Skip to content

Instantly share code, notes, and snippets.

@akovac35
Last active September 4, 2020 08:17
Show Gist options
  • Select an option

  • Save akovac35/07ea9cf03036a2a4119b8ece9f8decdd to your computer and use it in GitHub Desktop.

Select an option

Save akovac35/07ea9cf03036a2a4119b8ece9f8decdd to your computer and use it in GitHub Desktop.

Revisions

  1. akovac35 revised this gist Sep 4, 2020. 1 changed file with 0 additions and 3 deletions.
    3 changes: 0 additions & 3 deletions update_csproj_versions.sh
    Original file line number Diff line number Diff line change
    @@ -4,9 +4,6 @@
    # This bash script will increase the last digit of all csproj files within the current
    # solution folder which contain version element.

    export PATH=$(echo ${PATH} | awk -v RS=: -v ORS=: '/%/ {next} {print}' | sed 's/:*$//')

    # The following line will modify only the last digit of the version string
    while read -r line ; do
    echo "Processing $line"
    # Need to use intermediate file because of perl locks
  2. akovac35 revised this gist Sep 4, 2020. No changes.
  3. akovac35 revised this gist Sep 4, 2020. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions update_csproj_versions.sh
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,9 @@
    # 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.

    export PATH=$(echo ${PATH} | awk -v RS=: -v ORS=: '/%/ {next} {print}' | sed 's/:*$//')

    # The following line will modify only the last digit of the version string
  4. akovac35 created this gist Sep 4, 2020.
    11 changes: 11 additions & 0 deletions update_csproj_versions.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    export PATH=$(echo ${PATH} | awk -v RS=: -v ORS=: '/%/ {next} {print}' | sed 's/:*$//')

    # The following line will modify only the last digit of the version string
    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>" ./)