Hi,

I'm a newbie to Perl and need help with a script or at least getting started. The reason I want to do this in perl is because these files at times can be rather larger.

I have 2 files with data (see below).

File1

5 field per line, each field is separated by a space.

The text field is 1 word.

# # # text #

11111111111111111111 22222222222 3333333333333333 text 44444

File 2

4 field per line, each field is separated by a comma.

The first 2 numbers are a range.

The last 2 text fields can have 1-4 words per field.

#,#,text,text

11111111111111,44444444444444,"text text","text text text"

I need to find where the number in file1/column3 (3333333333333333) falls into the range in file2/column 1 and 2 by matching left to right.

So for this example this is a match because 1 is < 3 and 4 is > 3.

Now I need to take the whole line in file1 append the 2 text fields in file 2 to the end of the line and send to output file.

End result in new output file:

11111111111111111111 22222222222 3333333333333333 DVL0005c 44444 “text text” “text text text"


In reply to Please Help! by stockbr

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.