Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am working on removing comments from a C source file. Let's focus on multiline comments /* ... */ and ignore the inline ones (//)

The following command seems to work with (solaris) sed:

s:/\*.*\*/::g

However in Vim (7.2) it only works if the whole comment is on one line. How can I make it so the .* spreads over multiple lines? I tried doing the follwing

s:/\*.*[\r]*.*\*/::g

but it didn't work ...

share|improve this question

1 Answer 1

up vote 3 down vote accepted

I believe you'd want

s:/\*\_.*\*/::g

\_ tells it to include newlines in the following character set (well, ., anyway).

share|improve this answer
    
it worked, your rock ^^ –  rahmu Dec 21 '11 at 22:27

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.