Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Will this help?

by Rhose (Priest)
on Oct 02, 2009 at 14:08 UTC ( #798861=note: print w/replies, xml ) Need Help??

in reply to Reaped: This is rubbish I know.

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.

Replies are listed 'Best First'.
Re: Will this help?
by Win (Novice) on Oct 02, 2009 at 14:58 UTC
    I get the following error message with that.
    Can't open ..\newFile_totals_removed: No such file or directory.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://798861]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (1)
As of 2023-03-24 07:25 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (60 votes). Check out past polls.