I need to extract the names of functions defined in a C source file given as parameter to the script.
I’m not very familiar to PowerShell but shouldn’t be something like this:
If ($FileExists -eq $True)
{
select-string $args[0] -pattern "\(void\|double\|char\|int\) \.*(.*)"
}
I’d define the list of file extensions that you want to search in and use them in the Include parameter, then pipe to select-string and extract the capturing group matches.
Here’s a canned example using function names from wikipedia: