Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Reaped: This is rubbish I know.

by NodeReaper (Curate)
on Oct 02, 2009 at 13:22 UTC ( #798853=perlquestion: print w/replies, xml ) Need Help??
NodeReaper has asked for the wisdom of the Perl Monks concerning the following question:

This node was taken out by the NodeReaper on Oct 02, 2009 at 14:17 UTC
Reason: [marto]: Read: dupe of Re^4: Combining files, without supporting text.

You may view the original node and the consideration vote tally.

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://798853]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (4)
As of 2018-07-15 23:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (328 votes). Check out past polls.

    Notices?