Searching the head of CVS
Posted
by bobtheowl2
on Stack Overflow
See other posts from Stack Overflow
or by bobtheowl2
Published on 2010-06-07T22:18:06Z
Indexed on
2010/06/07
22:22 UTC
Read the original article
Hit count: 202
cvs
I'm looking for a 'relatively' easy way to search through cvs to look for a particular string in the HEAD revisions.
I realize the way CVS stores versions makes this difficult. But I'm trying to come up with some script to allow this search (performance is not expected here).
Currently this command will output the contents of the head files cvs co -r HEAD -p
stdout = file contents (to be grepped for the search string) stderr = the file name/header info (to be grepped for the line that signifies file name).
Ideally, I want to grep the contents and display the header + a few lines before and after the searched item (the output of this likely directed to some file).
I found a way to grep the stdout and stderr using different values. And the resulting stdout/stderr displayed is in the right order. But any attempt to redirect it to a file messes up the order?
{
{ cvs co -r HEAD -p myModule 4>&- | grep 'myString' 2>&4 4>&-
} 4>&2 2>&1 >&3 3>&- | grep 'Check' >&2 3>&-
} 3>&1
Question 1. Is there an easier way to do this all together?
Question 2. If not, how do I get the output of the code above to append to a file in the same order as displayed on the console?
© Stack Overflow or respective owner