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

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Here's one way which I believe works for your data (you should have shown your desired output for me to be sure):
use strict; use warnings; my $prev; while (<DATA>) { print $prev unless /^\d{5}\s/; $prev = $_; } print $prev unless $prev =~ /^\d{5}\s/; __DATA__ 00210 SHIFT PAY PRIV SYSOU 00211 SV-PROG OS SAVE 00215 OS MIGRATE SAVE 00217 DEM OS SUPER SAVE1 00219 DEM OS SUPER SAVE2 00221 DEM OS SUPER SAVE3 00901 DSDFIL 01401 PERISH STORE INV (V) INV810 BOB FERRANTE (EDIT REPORT IF 05309 PRSH INV) EXTRACT WAS RUN) (V) INV820 BOB FERRANTE (PERISHABLE INVENTORY REPORT) (VTD8) D:\DEPT\ACCT\MAIL\INV820.DAT (V) INV820C DIANE CALLAHAN (PERISHABLE INVENTORY-BAKERY) (QUARTERLY RUN ONLY) 01402 PERSH INV BOOKS (V) INV805 58 COPIES - BOB FERRANTE (V) INV805 2 COPIES - JIM MIAMIS (V) INV805A XTRA COPIES-SAVE IN COMPUTER ROOM ANNUAL STORE INVENTORY ONLY: (V) INV805 58 COPIES - USER (V) INV805 2 COPIES - USER (V) INV805A XTRA COPIES-SAVE IN COMPUTER ROOM 01403 BAKERY INV BOOKS (V) INV805 35 COPIES - USER (V) INV805A 5 COPIES - SAVE IN COMPUTER ROOM ANNUAL STORE INVENTORY ONLY: (J) INV805 35 COPIES - USER (J) INV805A 5 COPIES - SAVE IN COMPUTER ROOM 01405 PRSH INV. EXTRACT (V) MSI000 OPERATIONS DOCUMENTATION (MSI DUMP LISTING) 01501 INV PRICE GUIDE 01502 INV SLOTBOOK (V) CIO102 OPERATIONS SUPERVISOR (2 COPIES) (2 COPIES-IN BINDERS AND LEAVE WITH CODERS) PRICE GUIDES 01503 INV-DUPS THE FOLLOWING OUTPUT WILL ONLY BE PRODUCED IF DUPLICATE SLOTS ARE FOUND. (V) INV900 USER (V) INV969 USER

In reply to Re: Separating records by toolic
in thread Separating records by TStanley

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (10)
As of 2024-04-19 09:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found