Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

•Re: split mailbox one-liner

by merlyn (Sage)
on Mar 17, 2002 at 18:27 UTC ( #152332=note: print w/replies, xml ) Need Help??


in reply to split mailbox one-liner

Not that we're golfing, but a "-n" loop that ends in "print" seems odd. {grin} I've used something like:
perl -pe 'open STDOUT, ">out".++$n if /^From /' <in >before-first-outp +ut
before, with the advantage that the original pre-first-From output ends up in a file that is not part of the series.

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
Re: •Re: split mailbox one-liner
by jrasillo (Initiate) on Mar 26, 2002 at 07:04 UTC
    I'm trying to do something like this but instead of comparing it to From I'm comparing it to From:, but it doesn't seem to be working. Here's the code if ($line =~ /^From:\b/){whatever}
      That's because a normal "mailbox format" file isn't delimited by "From:"... it's delimited by "^From ". What kind of file do you have that might possibly be delimited by From:?

      -- Randal L. Schwartz, Perl hacker

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2019-02-19 15:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I use postfix dereferencing ...









    Results (104 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!