Counting commented lines in C code

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aparajita
    New Member
    • Mar 2008
    • 8

    #1

    Counting commented lines in C code

    In C scripts, The comments are multi lined starting from /* and ending with */.
    How can we count the commented lines if there are hundred scripts to be scanned.
    a grep command will give only the first and last line
  • gpraghuram
    Recognized Expert Top Contributor
    • Mar 2007
    • 1275

    #2
    Originally posted by aparajita
    In C scripts, The comments are multi lined starting from /* and ending with */.
    How can we count the commented lines if there are hundred scripts to be scanned.
    a grep command will give only the first and last line

    I think in sed you can get the lines starting with some pattern and ending with some pattern.
    Try to get it and then use wc -l on it and you will get the number of commented lines

    Raghuram

    Comment

    • aparajita
      New Member
      • Mar 2008
      • 8

      #3
      thank You...Will try and get back

      Comment

      Working...