Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to fetch the log message for a file committed to svn. I'm using the following command currently:

 svn --non-interactive log "myfile.c" | sed -e "s/[\-]//g"'   

The output is :

r42153 | sam | 2012-03-02 14:51:53 -0800 (Fri, 02 Mar 2012) | 1 line

Update to code.  

I would like to get rid of the first line "r42153 | sam |...." and output just the log message.

How can I do this?

share|improve this question
up vote 1 down vote accepted

use | grep -v "what you don't want to include" to leave out the lines you don't want. However, trying to leave out anything with a \n just leaves out everything, so don't do that.

share|improve this answer
Thanks @Dez. I forgot about grep. I ended up using grep -v "| [0-9]\+ line[s]\?$" – smokinguns Mar 10 '12 at 0:55

You can throw away useful lines from your commit messages while using grep. SVN provides propget command out of the box:


$ svn propget svn:log --revprop -r R [TARGET]

to get commit message


$ svn propget svn:log --revprop -r R [TARGET] --xml

to get it in XML.

TARGET is path to repository and can be omitted id you are in working copy.

share|improve this answer
This should be the accepted answer :) – Sebi Aug 21 '15 at 12:17
@Sebi Thank you ) – Denis Barmenkov Nov 20 '15 at 18:29

You can use | sed -e ':a;N;$!ba;s/-\+\(\n[^\n]*\n\)\?//g' to remove all "---" with treir next lines.

share|improve this answer

As long as you are logging a single revision, you can use

svn log -rXXXX | tail -n+4 | head -n-1

to get rid of everything except the message.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .