Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I want to write a script to map a field of numeric ranges with a field of strings. for example:
map data:
field1 field2
1234-1238 type1
1239 type2
556687-556695 type3
sample data:
123451112233
556688412563
1239445544
sample output
type1
type3
type2
above example means that I want to map(replace) any number that start with 1234 or 1235 .... or 1238 to string type1 and so on.
ranges can be a single number (like type2).
my map list is big (about 15000 records)
my data is big too (about 300000 records)
hi,
Try out the attach application. You will get a small idea. I have a small query for the above case.
You mention that you need to check starting from 1234 --- 1238 but in the third case the number is bigger one 556687-556695.
Is there any consitent way of looking into the sample data.
In my application I am not able to retrieve the type for this case.
Hope we can discuss and sort out the issue.
thanks for reply.
each row define new range and type I just explained row 1 to clarify (in my example row 3 means :
that I want to map(replace) any number that start with 556687 or 556688 .... or 556695 to string type3.)
ranges are numeric with unspecific length.
for example :
1122335566998877-1122335566998922 type4
so :
112233556699890567895463 is type4
HI,
Clarifying my doubts.
In first case you mention to take first 4 character 1234 and match it with the type ? the thrid data has 6 characters to be picked.
we need to have a standard logic for the extracting the data from sample data.
ok. I said that each row in map is new range of starting numbers, with any length.
so it can be XXXXXXabc-XXXXXXxyz
the length of X and "abc" is diffrent for each row.
if we expand this example :
field1 field2
1234-1238 type1
1239 type2
556687-556695 type3
we want to map numbers that start with :
1234* to | type1 |
1235* to | type1 |
1236* to | type1 |
1237* to | type1 |
1238* to | type1 |
1239* to | type2 |
556687* to | type3 |
556688* to | type3 |
556689* to | type3 |
556690* to | type3 |
556691* to | type3 |
556692* to | type3 |
556693* to | type3 |
556695* to | type3 |
in input data.