Groesbeek, view of the 'National Liberation Museum 1944-1945' in Groesbeek. © Ton Kersten
Fork me on GitHub

New version of

2010-12-20 (84) by Ton Kersten, tagged as git

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 and just press ZZ for all files. This would be tedious, I know.

So I decided to take the Geeks Shortcut and recode 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
    sed -i.bck  -e '/\$Id.*\$$/d' -e 's/    / /g' ${fname} -e -m 'Initial' ${fname}
    rm ${fname}.bck

This new version is with the other files and on GitHub.

Have fun smiley