svn log -r HEAD:1 | grep $pattern --line-buffered | awk '{print $1}'
The above prints out revision numbers for all commits the match the pattern
(e.g. are done by a certain user). This works fine except it keeps streaming the entire svn log (which might be very long) and will only end after it reaches its end.
Since I only need the most recent history I've tried this:
svn log -r HEAD:1 | grep $pattern --line-buffered | awk '{print $1}' | head
However this just hangs - I'm assuming it's waiting for the stream to end but that's unacceptable to me.
How do I prevent head
from waiting for the stream to end (and instead finish immediately after getting 10 lines)?
Since I only need the most recent history
I think you required -m
option with grep
.
Try this:
svn log -r HEAD:1 | grep -m 1 "$pattern"
-m NUM
- Stop reading a file after NUM matching lines.