Last active
December 18, 2015 18:29
-
-
Save supki/5825701 to your computer and use it in GitHub Desktop.
Increment first matched [number] in file using Vim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
# Try to increment first regex match in file | |
vimregex=$1 | |
filename=$2 | |
vim -es -u NONE \ | |
-c "${vimregex}" \ | |
-c ':normal ' \ | |
-c ':wq' "${filename}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment