I was working on a customers project and I had to change a lot of files.
This could easily be done with the sed
and find
commands, but I
wanted these changes to be checked in into git
as well. And I also
wanted the git
keywords expanded.
There was always the trick to edit all the files with sed
, then edit
them again with git.vi
and just press ZZ
for all files. This would
be tedious, I know.
So I decided to take the Geeks Shortcut and recode git.vi
so
everything can be be done automatic.
I added the -e
option, meaning noEdit and the `edit step' will be
skipped.
So, now things like this are possible:
find . -type f | grep -v '^./.git' | while read fname
do
sed -i.bck -e '/\$Id.*\$$/d' -e 's/ / /g' ${fname}
git.vi -e -m 'Initial' ${fname}
rm ${fname}.bck
done
This new version is with the other files and on GitHub.
Have fun ;-)