http://qs321.pair.com?node_id=798853

NodeReaper has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Will this help?
by Rhose (Priest) on Oct 02, 2009 at 14:08 UTC
    Maybe something like:

    type * 2>NUL | perl -n -e "print if /^Total\s\d{1,5}/;" > ..\newFile

    When you use type with a wildcard like this, the file name being "typed" is sent to STDERR. The above removes those by redirecting STDERR to NUL (aka "the bit bucket".) The -n switch on perl wraps the program in a "while (<>) {}" loop... the "program" then prints the line if the pattern matches what you want (please note, you'll have to play with the pattern to make it what you really want). Those results are then redirected to newFile in the parent directory.

    Again, the pattern I have is not exactly the same as yours (for example, I anchored it to the start of the line.) You might also want to make it case insensitive.

    I'm not around very much, so chances are I may well miss any follow up questions... I'm just hoping this helps out a tad.

      I get the following error message with that.
      Can't open ..\newFile_totals_removed: No such file or directory.