Jun 25, 2009, 11:08 AM
Post #6 of 7
Re: [zivsegal] grep long string
[In reply to]
Unless your engineers have been incredibly diciplined, you will have no control over the format, content, or position of existing headers in your source code. If that is the case, it is unlikely you will be able to devise a parse that will be safe enough to avoid manual review of every file.
Instead, I would break cleaning up the old headers and adding the new ones into separate operations. The first operation will be somewhat manual, but the second can be fully automated (given a complete and correct headers list).
For cleanup, I would recommend:
1. Figure out some string of text or regular expression that can detect an 'old-style' header.
2. Run a find command to develop a list of files containing old-style headers. For example, if an old-style header contains the string "author: ", you could go to your code root and:
And delete them interactively.
vim `find * -name '*.c' -exec grep -i 'author: ' -print`