stockbr has asked for the wisdom of the Perl Monks concerning the following question:
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"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Please Help!
by toolic (Bishop) on May 24, 2016 at 17:15 UTC | |
|
Re: Please Help!
by ww (Archbishop) on May 24, 2016 at 18:43 UTC | |
|
Re: Please Help!
by Marshall (Canon) on May 25, 2016 at 10:40 UTC |