I would like to join data files that contain different attributes and produce one multicolumn file.

The individual files contain:

Date Time Latitude Longitude Attribute

The attributes are gravity (file 1), magnetics (file2) and bathymetry (file 3).

The final file would be:

Date Time Latitude Longitude Attribute1 Attribute2 Attribute3

I can join them if the individual files start at the same time and have the same length, but I have files that start and end at different times. If an attribute doesn't exist, I intend to enter a null value.

I am wondering if there is a construct that I should be looking at to perform this. I am currently importing each file into an array and then using the most confusing set of ifs and elsifs to cover each possibility.

I have toyed with cutting the input files into segments that are the same size and doing each in turn (ie. gravity and magnetics only, gravity and bathymetry only, bathymetry only). I thought I'd ask if there is another way.

Any suggestions greatly appreciated.

Thanks


In reply to Joining separate data files to make one. by msexton

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.