I am looking for a one liner to pull out the first comment block in any file. The comment blocks look like this:
/*
* This is a
* comment block
*/
I’ve been trying to play with sed, but just can’t get it to work right. Help?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Or equivalently:
Edit:
Here is a version of the second one above that handle’s the situation mentioned in ghostdog74’s comment:
And if you want to handle whitespace at the beginning and end of lines: