Michael G Schwern <[EMAIL PROTECTED]> wrote: > perl -ne "$saw_bang++ if /^#!.*(perl|PERL)/; print if $saw_bang && (!/^\s*#/ || > /^\s*#\s*(include|define|if|ifdef|ifndef|else|elif|undef|endif)/)" your_file
How about this? perl -pe"$_=''if 1../^#!.*perl/i;/^\s*#\s*(include|define|if(n?def)?|el(se|if)|undef|endif)/||s/^\s*#.*//s" Still too long (107 characters), and I cheated on the /^#!.*(perl|PERL)/ part -- but then I think you're already cheating by not checking what follows the preprocessor keywords. Anyway, the scalar range operator is the real contribution. I'm sure further improvement is possible. -- Keith C. Ivey <[EMAIL PROTECTED]> Washington, DC
