I have two files and would need to filter out records based on certain criteria, these column are of variable lengths, but the lengths are uniform throughout all the records of the file. I have shown a sample of three records below. Line 1-9 is the item number "0227546_1" in the case of the first record, the department number is line 361-369, which would be 3101_1_1 in the first record. I would want to compare two files for item numbers (keep in mind they could be at different records in these two files) and if they have a different department number I would need the entire record to be filtered out in a third file.
I have also included a sample of the second file and expected output as there was a change in dept #, it only shows two records.
Any help will be greatly appreciated, I have been struggling with this for a while.
First file:
0227546_1 0227546,OIL FILTER PH3675 HONEYWELL
0227546A 0227546,OIL FILTER PH3675 HONEYWELL
0227546 0227546,OIL FILTER PH3675 HONEYWELL
0 0
3101_1_1 Under Car
3101_1 Parts and Repair
3101 Auto Retail
301 Automotive
2 Hardlines
9000 WORLDWIDE
EA EACH 0 0
0227546A 0227546,OIL FILTER PH3675 HONEYWELL
0227546A 0227546,OIL FILTER PH3675 HONEYWELL
0 0
3101_1_1 Under Car
3101_1 Parts and Repair
3101 Auto Retail
301 Automotive
2 Hardlines
9000 WORLDWIDE
0 0
0249068_1 0249068,Fresco Castiglione Chianti
0249068A 0249068,Fresco Castiglione Chianti
0249068 0249068,Fresco Castiglione Chianti
0 0
1022_1_2 Table
1022_1 Red
1022 Wine
422 Wine
3 Consumables
9000 WORLDWIDE
EA EACH 0 0
0249068A 0249068,Fresco Castiglione Chianti
0249068A 0249068,Fresco Castiglione Chianti
0 0
1022_1_2 Table
1022_1 Red
1022 Wine
422 Wine
3 Consumables
9000 WORLDWIDE
0 0
0274321_1 0274321,SIMPLY PERFECT SILVER KING
0274321A 0274321,SIMPLY PERFECT SILVER KING
0274321 0274321,SIMPLY PERFECT SILVER KING
0 0
1478_3_2 Down Pillows
1478_3 Down Products
1478 White Goods
478 Domestics
2 Hardlines
9000 WORLDWIDE
EA EACH 0 0
0274321A 0274321,SIMPLY PERFECT SILVER KING
0274321A 0274321,SIMPLY PERFECT SILVER KING
0 0
1478_3_2 Down Pillows
1478_3 Down Products
1478 White Goods
478 Domestics
2 Hardlines
9000 WORLDWIDE
0 0
Second File:
0249068_1 0249068,Fresco Castiglione Chianti
0249068A 0249068,Fresco Castiglione Chianti
0249068 0249068,Fresco Castiglione Chianti
0 0
1022_1_2 Table
1022_1 Red
1022 Wine
422 Wine
3 Consumables
9000 WORLDWIDE
EA EACH 0 0
0249068A 0249068,Fresco Castiglione Chianti
0249068A 0249068,Fresco Castiglione Chianti
0 0
1022_1_2 Table
1022_1 Red
1022 Wine
422 Wine
3 Consumables
9000 WORLDWIDE
0 0
0274321_1 0274321,SIMPLY PERFECT SILVER KING
0274321A 0274321,SIMPLY PERFECT SILVER KING
0274321 0274321,SIMPLY PERFECT SILVER KING
0 0
1478_5_1 Down Pillows
1478_3 Down Products
1478 White Goods
478 Domestics
2 Hardlines
9000 WORLDWIDE
EA EACH 0 0
0274321A 0274321,SIMPLY PERFECT SILVER KING
0274321A 0274321,SIMPLY PERFECT SILVER KING
0 0
1478_3_2 Down Pillows
1478_3 Down Products
1478 White Goods
478 Domestics
2 Hardlines
9000 WORLDWIDE
0 0
0308148_1 0308148,CLEMENTE VII/BARRIQUE 750ML GASTELGREVE
0308148A 0308148,CLEMENTE VII/BARRIQUE 750ML GASTELGREVE
0308148 0308148,CLEMENTE VII/BARRIQUE 750ML GASTELGREVE
0 0
1022_1_2 Table
1022_1 Red
1022 Wine
422 Wine
3 Consumables
9000 WORLDWIDE
EA EACH 0 0
0308148A 0308148,CLEMENTE VII/BARRIQUE 750ML GASTELGREVE
0308148A 0308148,CLEMENTE VII/BARRIQUE 750ML GASTELGREVE
0 0
1022_1_2 Table
1022_1 Red
1022 Wine
422 Wine
3 Consumables
9000 WORLDWIDE
0 0
Third file (Output):
0249068_1 0249068,Fresco Castiglione Chianti
0249068A 0249068,Fresco Castiglione Chianti
0249068 0249068,Fresco Castiglione Chianti
0 0
1022_1_2 Table
1022_1 Red
1022 Wine
422 Wine
3 Consumables
9000 WORLDWIDE
EA EACH 0 0
0249068A 0249068,Fresco Castiglione Chianti
0249068A 0249068,Fresco Castiglione Chianti
0 0
1022_1_2 Table
1022_1 Red
1022 Wine
422 Wine
3 Consumables
9000 WORLDWIDE
0 0
0308148_1 0308148,CLEMENTE VII/BARRIQUE 750ML GASTELGREVE
0308148A 0308148,CLEMENTE VII/BARRIQUE 750ML GASTELGREVE
0308148 0308148,CLEMENTE VII/BARRIQUE 750ML GASTELGREVE
0 0
1022_1_2 Table
1022_1 Red
1022 Wine
422 Wine
3 Consumables
9000 WORLDWIDE
EA EACH 0 0
0308148A 0308148,CLEMENTE VII/BARRIQUE 750ML GASTELGREVE
0308148A 0308148,CLEMENTE VII/BARRIQUE 750ML GASTELGREVE
0 0
1022_1_2 Table
1022_1 Red
1022 Wine
422 Wine
3 Consumables
9000 WORLDWIDE
0 0