Skip to content

Instantly share code, notes, and snippets.

@supki
Last active December 18, 2015 18:29
Show Gist options
  • Save supki/5825701 to your computer and use it in GitHub Desktop.
Save supki/5825701 to your computer and use it in GitHub Desktop.
Increment first matched [number] in file using Vim
#!/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