Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: Help with problem (CUTTING TEXT FILES)

by live4tech (Sexton)
on May 23, 2012 at 17:17 UTC ( #972071=note: print w/replies, xml ) Need Help??


in reply to Re: Help with problem
in thread Help with problem

Aaron, that grep line looks promising (short and 'simple' - I like that!). I do not really understand it, but I want to, so I will review grep in perldocs and elsewhere and hopefully be able to decipher the line so I will be able to adapt it to my needs in the future. Thanks so much!

To everyone else who has commented, thank you too! The logic in the if statements in the original code is correct.

I am going to try the simpler and prettier code written by Athanasius. BTW - I know the row count is correct because I looked at it in a few ways and checked a number of lines at the beginning, middle and end of several cut files against the original and these were right on. I will update the Monastery after I try the new code.

One last note - I mentioned I was working through the "Camel" book; well actually its the "Llama" book... sorry Perlers.

  • Comment on Re^2: Help with problem (CUTTING TEXT FILES)

Replies are listed 'Best First'.
Re^3: Help with problem (CUTTING TEXT FILES)
by aaron_baugher (Curate) on May 23, 2012 at 20:08 UTC

    Thanks! Here's that command line explained bit by bit:

    grep grep for -v lines that DO NOT match ^$ an empty line (begin and end with nothing between) inputfile in the file "inputfile" | pipe the results to split the split program, which divides up a file -d naming the output files with digits -l 300000 and putting 300000 lines in each - getting the input from stdin (the pipe) outputfile and naming the output files starting with outputfile (fol +lowed by digits)

    Aaron B.
    Available for small or large Perl jobs; see my home node.

      ack -v "^\s*$" | split ...

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2022-12-07 06:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?