I everyone. I am at a brick wall. I am attempting to match a pattern that is inconsistant in a large file.
Back ground. This is a circuit report that is generated to a flat file. The report wraps the circuit name to the next line if it goes beyone it's parameters.
Example:
Circuit 12.27 ABC WIRELESS nnn-n |Up |VCC | |
nnn | | | |
ABC1 | |50.1 |12|ON
ABC1 | |50.2 | 3|Off
This is shortened for readability but the beginning is what I am looking at.
In this file all circuits are represented in either 3 or 4 lines.
Circuit Name line is either followed by the rest of circuit name/number or ABC1|ABC2.
What I need is to join second 1/2 of Circuit name on line two to line one circuit name.
The first line always starts at ^
the second line (if wrapped) starts at the fifth space from ^
the third and fourth line (ABC1|ABC2) starts at the second space from ^
or if not wrapped first line starts at ^
second and third start at the seond space from ^
any help would be greatly appreciated.
Thank you
Lost Boy
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.