
rovf
Veteran
Nov 5, 2012, 3:48 AM
Post #4 of 7
(961 views)
|
|
Re: [johnchandler32] pattern matching
[In reply to]
|
Can't Post
|
|
Not all the fields matches. Field $2 $4 $5 do not match the next row in the output. Well, field 2 is either BUY or SELL, which is a good thing, because otherwise you can't correlate the lines. Fields 4 and 5 are just the reverse, but are you interested in their content? I think you need only fields 1, 3 and 6 for identifying the transaction, provided it is really the case - as you seem to assume - that things are sold always on the same day as they are bought, which is, IMO, a strange assumption. For analyzing the lines, I would first split them into individual fields. Perhaps it is best to first extract field 2 (because this field is different, in that it can contain embedded spaces, and is delimited by quotes), and then use split to split the remaining line into individual fields. You can then use for your comparision between two successive rows exactly those fields you are interested in.
|