The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 11-16-2007
Franklin52 Franklin52 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,317
Quote:
Code:
sed -n '/\/\//d; /\/\*/d ; /\*\//d ;/\//p' hello.c
This doesn't work if you have lines like:

Code:
a=30/6;	/* Comment */
a=10/2;	// comment
Try this:

Code:
sed -n '/[0-9a-zA-Z] *\/ *[0-9a-zA-Z]*/p' file.c
Regards