Hi SK,

Thanks a lot.. It worked. Making few minor tweaks. :)

On Apr 24, 11:59 am, Shakthi Kannan <[email protected]> wrote:
> Hi,
>
> --- On Thu, Apr 23, 2009 at 6:48 PM, tecgaty <[email protected]> wrote:
> | An extra line, comment with function name,  should be added to every
> | function block in the above file.. The desired output is the
> \--
>
> Tweak the following if your input format changes:
>
> === file.awk ===
>
> BEGIN { count = 0 }
> {
>     if (/function/) {
>         print
>         if (gsub(/{/,"",$2)) { # If it is function a{
>             gsub(/{/,"",$2)
>             print "/* This is " $1 " " $2 " */"
>         }
>         else { # If it is function a
>             funct_name = $2
>             count = 1
>         }
>     }
>     else if (/^{/) {
>         if (count == 1) {
>             print
>             gsub(/{/,"",funct_name1)
>             print "/* This is " funct " " funct_name " */"
>             count = 0
>         }
>     }
>     else
>         print}
>
> END { }
>
> === file.awk END ===
>
> Run it like:
>
>   awk -f file.awk inputfile.c
>
> SK
>
> --
> Shakthi Kannanhttp://www.shakthimaan.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MyLUG" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/mylug?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to