Hello, everyone,
I am a very beginner of Perl but I knew Perl will easily
solve my problem. Basically, I'd like to merge two ACSII
text data into one by time-stamp.
file1.txt (second column is time-stamp):
Feb-21,19:08:05.2,$GP,48.96,90.92,45.69
Feb-21,19:08:06.4,$GP,48.92,90.92,45.70
Feb-21,19:08:07.6,$GP,48.93,90.99,45.66
Feb-21,19:08:08.1,$GP,48.92,90.95,45.66
Feb-21,19:08:09.0,$GP,48.85,90.92,45.62
Feb-21,19:08:10.8,$GP,48.92,90.94,45.63
file2.txt(second column is time-stamp but not
corresponding to the one of file1.txt):
Feb-21,19:08:05.2,$BM,3.89
Feb-21,19:21:20.5,$BM,5.05
Feb-21,19:08:07.6,$BM,6.20
Feb-21,19:21:20.8,$BM,7.36
Feb-21,19:08:09.0,$BM,8.52
Feb-21,19:08:10.8,$BM,9.68
Output.txt will look like this:
Feb-21,19:08:05.2,$GP,48.96,90.92,45.69,19:08:05.2,$BM,3.89
Feb-21,19:08:06.4,$GP,48.92,90.92,45.70,
Feb-21,19:08:07.6,$GP,48.93,90.99,45.66,19:08:07.6,$BM,6.20
Feb-21,19:08:08.1,$GP,48.92,90.95,45.66,
Feb-21,19:08:09.0,$GP,48.85,90.92,45.62,19:08:09.0,$BM,8.52
Feb-21,19:08:10.8,$GP,48.92,90.94,45.63,19:08:10.8,$BM,9.68
Both data are of huge table file with comma delimitation.
Thank you very much for your help.
Quinn
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.