Try following.
x="refactoring"; svn log --limit 10 | egrep -i --color=none "($x|^r[0-9]+ \|.*lines$)" | egrep -B 1 -i --color=none $x | egrep --color=none "^r[0-9]+ \|.*lines$" | awk '{print $1}' | sed 's/^r//g'
Replace refactoring
with search string.
Change svn log
parameters to suite your need.
Case insensitive matching is used (egrep -i
).
Edit based on comment.
x="ILIES-113493"; svn log | egrep -i --color=none "($x|^r[0-9]+ \|.*lines$)" | egrep -B 1 -i --color=none $x | egrep --color=none "^r[0-9]+ \|.*lines$" | awk '{print $1}' | sed 's/^r//g'
Notes:
x
is the variable to contain the search string, and x
is used in
two places in the command.
- In order to use
x
as a variable in the shell itself, you need to put entire command on a single line (from x=".."; svn log ... sed '...'
). Semicolon ;
can be used to separate multiple commands on the same line.
- I had used
--limit 10
in example to limit the number of log entries,
change that as well as use other svn log
parameters to suite your
need. Using --limit 10
will restrict the search to 10 most recent log entries.