thanks tybalt89! This seems to work very well! =)

Ok... one last question:
Say I have a file containing the following data lines: Timestamp: 00:47:14 SATID 13 VAL1 28 VAL2 227 SIGNAL 37 + SATID 15 VAL1 22 VAL2 265 SIGNAL 30 SATID 16 VA +L1 22 VAL2 265 SIGNAL 30 Timestamp: 00:48:14 SATID 13 VAL1 28 VAL2 227 SIGNAL 37 + SATID 15 VAL1 22 VAL2 265 SIGNAL NA SATID 16 VA +L1 22 VAL2 265 SIGNAL 30 Timestamp: 00:49:14 SATID 14 VAL1 +22 VAL2 265 SIGNAL 30
Can I use perl so that it will automatically "fill in" the missing cells with the ID of the SATID for its corresponding column, while filling in the VAL1, VAL2 and SIGNAL with "nan"?
For instance, the desired output would be: Timestamp: 00:47:14 SATID 13 VAL1 28 VAL2 227 SIGNAL 37 SATID 14 VAL1 +nan VAL2 nan SIGNAL nan SATID 15 VAL1 22 VAL2 265 SIGNAL 30 SATID 16 +VAL1 22 VAL2 265 SIGNAL 30 Timestamp: 00:48:14 SATID 13 VAL1 28 VAL2 227 SIGNAL 37 SATID 14 VAL1 +nan VAL2 nan SIGNAL nan SATID 15 VAL1 22 VAL2 265 SIGNAL nan SATID 16 + VAL1 22 VAL2 265 SIGNAL 30 Timestamp: 00:49:14 SATID 13 VAL1 nan VAL2 nan SIGNAL nan SATID 14 VAL +1 22 VAL2 265 SIGNAL 30 SATID 15 VAL1 nan VAL2 nan SIGNAL nan SATID 1 +6 VAL1 nan VAL2 nan SIGNAL nan
Thanks again! =)

In reply to Re^2: Preserving "Valid" Data? by coding1227
in thread Preserving "Valid" Data? by coding1227

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



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.