Skip to content

Instantly share code, notes, and snippets.

@is
Last active March 18, 2020 17:45
Show Gist options
  • Save is/df6fd5abd569abd6b6bde454534da045 to your computer and use it in GitHub Desktop.
Save is/df6fd5abd569abd6b6bde454534da045 to your computer and use it in GitHub Desktop.
set VERSION = 20.20.20
VER_NUMBER = 10.10.10
#!/bin/sh
V=$(grep "VERSION" a.txt |sed -e 's/^.* *= *//g')
sed -e 's/\(VER_NUMBER *= *\)\([^ \t]*\)/\1__VERSION__/g' \
-e "s/__VERSION__/$V/g" b.txt
#!/bin/sh
V=$(grep "VERSION" a.txt |sed -e 's/^.* *= *//g')
sed -e "s/VER_NUMBER *= *\([^ \t]*\)/VER_NUMBER = $V/g" b.txt
@feizheng10
Copy link

V=$(sed -n -e "s/^.VERSION.//p" a.txt)
sed -e "s/VER_NUMBER *= ([^ \t])/VER_NUMBER = $V/g" b.txt

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