I am trying to use sed to get the number of insertions/deletions from diff stat. For example, diffstat gives something like "1 file changed, 2 insertions(+), 1 deletion(-)". How can I retrieve "2" from diffstat using sed? I can't seem to figure it out.
Thanks for your time.
Figured out very simple solution-
sed 's|.*\s\(.*\)\sinsertion.*|\1|'
Explanation: look for "[anything], [something] insertions[anything]" and replace it with [something]. Might want to pass the diffstat through grep first to isolate this one line.