I am trying to convert the following:
bool foo(int a, unsigned short b)
{
return pImpl->foo(int a, unsigned short b);
}
in
bool foo(int a, unsigned short b)
{
return pImpl->foo(a, b);
}
In other words, I need to remove the type definition in strings that are not a function definition.
I am using Linux.
The following removes the type in both lines:
perl -p -e 's/(?<=[,(])\s*?(\w+ )*.*?(\w*)(?=[,)])/ $2/g;' fileName.cpp
How to replace only the line starting with 'return' and still make several changes on the same line?
source
share