Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

4 Answers 4

up vote 2 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
add comment

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

share|improve this answer
add comment

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
add comment

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

use

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

to get commit message

or

$ 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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.