manage comments (sed)

March 28, 2011 at 04:29:32
Specs: Windows XP
Hi all, I want to check a file with name 1.c if the comments are in the suitable format.
The format is

If it is no, I have to convert it.
For example
/*comment */

I am trying to use a regular expression with sed but something goes wrong
sed -e 's:\/\[*]+:\/\*\*\n:g' 1.c

Could you help me please

See More: manage comments (sed)

Report •

March 28, 2011 at 19:52:09
This should work for you:

sed -e 's/\/\*\+/\/\*\*\n/g' 1.c

Click Here on HowTo ask good Question to get best Help
Let us know, if the problem is solved !!!

Report •

March 28, 2011 at 23:23:09

$ ruby -pne '$_.gsub!(/\/\*/, "/**\n" ).gsub!(/\*\//,"\n*/")  if /\/\*.*\*\//' file

Report •

March 30, 2011 at 05:47:36
thanks a lot

Report •
Related Solutions

Ask Question