in reply to Re: empty out C function bodies
in thread empty out C function bodies
perl -e 'undef $/; $ENV{f}=$ARGV[0]; $_=`cat -- "\$f"`;
Backquotes in scalar context already do what you want regardless of the contents of $/ and you can use $ARGV[0] directly instead of copying it to the environment, so that then becomes:
perl -e ' $_=`cat -- "$ARGV[0]"`;
You could also simplify that whole thing with the use of the -0 switch and the -p switch:
perl -0777pe's/^(\w+[^\n;]*?\([^\n;]*\n\{\n)[\s\S]+?\n(\}\n)/$1$2/mg' +FILE.c > FILE_MODIFIED.c
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: empty out C function bodies
by jakobi (Pilgrim) on Oct 24, 2009 at 14:09 UTC |