Suelo hacer algunos scripts en base a código copypasteado que encuentro en el foro y he consultado cuando éstos exceden mi capacidad de comprensión.. normalmente consigo asi lo que busco.
La cuestión es que prescisamente ahora estoy necesitando realizar una tarea de esas que superan mi capacidad de comprensión.. y es que no tengo ni la menor idea de cómo conseguir lo que quiero..
Tengo un archivo con éste formato
Código:
Encabezado_1
linea del Encabezado_1 con info sobre éste
linea del Encabezado_1 con info sobre éste
linea del Encabezado_1 con info sobre éste
linea del Encabezado_1 con info sobre éste
Encabezado_2
linea del Encabezado_2 con info sobre éste
linea del Encabezado_2 con info sobre éste
linea del Encabezado_2 con info sobre éste
linea del Encabezado_2 con info sobre éste
linea del Encabezado_2 con info sobre éste
linea del Encabezado_2 con info sobre éste
Encabezado_3
linea del Encabezado_3 con info sobre éste
linea del Encabezado_3 con info sobre éste
linea del Encabezado_3 con info sobre éste
Encabezado_4
linea del Encabezado_4 con info sobre éste
y necesito disponerlo de ésta forma..
Citar
Encabezado_1 linea del Encabezado_1 con info sobre éste
Encabezado_1 linea del Encabezado_1 con info sobre éste
Encabezado_1 linea del Encabezado_1 con info sobre éste
Encabezado_1 linea del Encabezado_1 con info sobre éste
Encabezado_2 linea del Encabezado_2 con info sobre éste
Encabezado_2 linea del Encabezado_2 con info sobre éste
Encabezado_2 linea del Encabezado_2 con info sobre éste
Encabezado_2 linea del Encabezado_2 con info sobre éste
Encabezado_2 linea del Encabezado_2 con info sobre éste
Encabezado_2 linea del Encabezado_2 con info sobre éste
Encabezado_3 linea del Encabezado_3 con info sobre éste
Encabezado_3 linea del Encabezado_3 con info sobre éste
Encabezado_3 linea del Encabezado_3 con info sobre éste
Encabezado_4 linea del Encabezado_4 con info sobre éste
Encabezado_1 linea del Encabezado_1 con info sobre éste
Encabezado_1 linea del Encabezado_1 con info sobre éste
Encabezado_1 linea del Encabezado_1 con info sobre éste
Encabezado_2 linea del Encabezado_2 con info sobre éste
Encabezado_2 linea del Encabezado_2 con info sobre éste
Encabezado_2 linea del Encabezado_2 con info sobre éste
Encabezado_2 linea del Encabezado_2 con info sobre éste
Encabezado_2 linea del Encabezado_2 con info sobre éste
Encabezado_2 linea del Encabezado_2 con info sobre éste
Encabezado_3 linea del Encabezado_3 con info sobre éste
Encabezado_3 linea del Encabezado_3 con info sobre éste
Encabezado_3 linea del Encabezado_3 con info sobre éste
Encabezado_4 linea del Encabezado_4 con info sobre éste
Esto es porque necesito exportarlo a Excel y saber a qué encabezado corresponde cada linea.. Me es indistinto si la función se realiza sobre el archivo de texto o si es en Excel donde de doy el nuevo formato después de exportado..
El archivo de ejemplo es éste:
Código:
1,0,POSNET,120,007,031213,XXXXXXXXX
ON,COMPRA,031213,192907,DEB ,MC DEBIT,5118********9019,B,994763,1158,-$-,98304,XXX,001,08682581,XXXXXXXXX,,,,,0001________,0,000,120
ON,COMPRA,031213,193017,DEB ,MC DEBIT,5118********9019,B,128025,1159,-$-,17870,XXX,001,08682581,XXXXXXXXX,,,,,0001________,0,000,120
ON,COMPRA,031213,202521,DEB ,MC DEBIT,5118********5006,B,785819,1160,-$-,95267,XXX,001,08682581,XXXXXXXXX,,,,,0001________,0,000,120
ON,COMPRA,031213,202806,DEB ,MC DEBIT,5118********5006,B,495903,1161,-$-,52711,XXX,001,08682581,XXXXXXXXX,,,,,0001________,0,000,120
ON,COMPRA,031213,204556,DEB ,MAESTRO,5010**********2014,B,001473,1162,-$-,98551,CAP,001,08682581,XXXXXXXXX,,,,,0001________,0,000,120
ON,COMPRA,031213,204819,DEB ,MAESTRO,5010**********2014,B,001474,1163,-$-,54925,CAP,001,08682581,XXXXXXXXX,,,,,0001________,0,000,120
ON,COMPRA,031213,210103,DEB ,MC DEBIT,5118********4002,B,319112,1164,-$-,85643,XXX,001,08682581,XXXXXXXXX,,,,,000100139073,0,000,120
1,1,VISA -$-,120,011,031213,XXXXXXXXX
ON,COMPRA,031213,191625,DEB ,VISA DEBITO,4517********6014,B,695669,1468,-$-,94770,XXX,001,13872437,XXXXXXXXX,,,,,0001________,1,,120
ON,COMPRA,031213,192232,DEB ,VISA DEBITO,4517********6014,B,748876,1469,-$-,82049,XXX,001,13872437,XXXXXXXXX,,,,,0001________,1,,120
ON,COMPRA,031213,193320,CRED,VISA,4508********4783,B,000623,1470,-$-,35907,,001,13872437,XXXXXXXXX,,,,,0001________,1,,120
ON,COMPRA,031213,200048,CRED,NARANJA,5895********7055,B,588010,1471,-$-,96872,,011,100232390,XXXXXXXXX,,,,,000100139059,1,,120
ON,COMPRA,031213,200858,CRED,VISA,4509********9034,B,005957,1472,-$-,87805,,001,13872437,XXXXXXXXX,,,,,000100139061,1,,120
ON,COMPRA,031213,201534,CRED,NARANJA,5895********1008,B,976746,1473,-$-,39000,,011,100232390,XXXXXXXXX,,,,,0001________,1,,120
ON,COMPRA,031213,205437,DEB ,VISA DEBITO,4517********9826,B,819659,1474,-$-,95497,XXX,001,13872437,XXXXXXXXX,,,,,000100139071,1,,120
ON,COMPRA,031213,205537,DEB ,VISA DEBITO,4517********9826,B,704104,1475,-$-,12650,XXX,001,13872437,XXXXXXXXX,,,,,0001________,1,,120
ON,COMPRA,031213,210534,CRED,NARANJA,5895********4017,B,224612,1476,-$-,92379,,011,100232390,XXXXXXXXX,,,,,0001________,1,,120
ON,COMPRA,031213,211242,CRED,NARANJA,5895********8060,B,815483,1477,-$-,99599,,011,100232390,XXXXXXXXX,,,,,0001________,1,,120
ON,COMPRA,031213,211723,CRED,NARANJA,5895********8060,B,909461,1478,-$-,84952,,011,100232390,XXXXXXXXX,,,,,000100139077,1,,120
1,0,POSNET,088,014,031213,XXXXXXXXX
ON,COMPRA,031213,161214,CRED,MC-BANCOR,5427********8275,B,151143,1065,-$-,99858,,003,12867312,XXXXXXXXX,,,,,000100014111,0,020,088
ON,COMPRA,031213,161821,CRED,MC-BANCOR,5427********8275,B,646773,1066,-$-,99644,,003,12867312,XXXXXXXXX,,,,,000100098821,0,020,088
ON,COMPRA,031213,163652,CRED,MC-BANCOR,5427********2813,B,998702,1067,-$-,97268,,003,12867312,XXXXXXXXX,,,,,000100023666,0,020,088
ON,COMPRA,031213,165519,DEB ,MC DEBIT,5118********7003,B,886591,1068,-$-,85322,XXX,001,08682581,XXXXXXXXX,,,,,000100023666,0,000,088
ON,COMPRA,031213,194822,DEB ,MC DEBIT,5118********5012,B,327447,1069,-$-,99736,XXX,001,08682581,XXXXXXXXX,,,,,000100983158,0,000,088
ON,COMPRA,031213,195045,DEB ,MC DEBIT,5118********5012,B,765894,1070,-$-,30727,XXX,001,08682581,XXXXXXXXX,,,,,000100023666,0,000,088
ON,COMPRA,031213,195610,DEB ,MAESTRO,5010**********8007,B,001333,1071,-$-,99969,CAP,001,08682581,XXXXXXXXX,,,,,000100236666,0,000,088
ON,COMPRA,031213,200104,DEB ,MAESTRO,5010**********8007,B,001334,1072,-$-,70718,CAP,001,08682581,XXXXXXXXX,,,,,000100098317,0,000,088
ON,COMPRA,031213,200838,DEB ,MAESTRO,5010**********8033,B,001335,1073,-$-,99541,CAP,001,08682581,XXXXXXXXX,,,,,000100009818,0,000,088
ON,COMPRA,031213,201439,DEB ,MAESTRO,5010**********8033,B,001336,1074,-$-,90887,CAP,001,08682581,XXXXXXXXX,,,,,000100098319,0,000,088
ON,COMPRA,031213,211550,CRED,MC-BANCOR,5427********3613,B,717774,1075,-$-,66461,,003,12867312,XXXXXXXXX,,,,,000100007839,0,020,088
ON,COMPRA,031213,212744,DEB ,MAESTRO,5010**********8038,B,001338,1076,-$-,97022,CAP,001,08682581,XXXXXXXXX,,,,,000100098332,0,000,088
ON,COMPRA,031213,213341,DEB ,MAESTRO,5010**********8038,B,001339,1077,-$-,67973,CAP,001,08682581,XXXXXXXXX,,,,,000100983333,0,000,088
ON,COMPRA,031213,214801,DEB ,MC DEBIT,5118********5006,B,123155,1078,-$-,99104,XXX,001,08682581,XXXXXXXXX,,,,,000100098335,0,000,088
1,1,VISA -$-,087,015,031213,XXXXXXXXX
ON,COMPRA,031213,154022,DEB ,VISA DEBITO,4517********6256,B,745665,1376,-$-,99993,XXX,001,13872437,XXXXXXXXX,,,,,000100098274,1,,087
ON,COMPRA,031213,155637,DEB ,VISA DEBITO,4517********9420,B,171713,1377,-$-,66260,XXX,001,13872437,XXXXXXXXX,,,,,000100098227,1,,087
ON,COMPRA,031213,160154,DEB ,VISA DEBITO,4517********9420,B,797755,1378,-$-,99213,XXX,001,13872437,XXXXXXXXX,,,,,000100098279,1,,087
ON,COMPRA,031213,160445,DEB ,VISA DEBITO,4517********9420,B,075536,1379,-$-,34514,XXX,001,13872437,XXXXXXXXX,,,,,000100098279,1,,087
ON,COMPRA,031213,184255,CRED,NARANJA,5895********7055,B,034473,1380,-$-,99530,,011,100232390,XXXXXXXXX,,,,,000100008302,1,,087
ON,COMPRA,031213,184717,CRED,NARANJA,5895********7055,B,439376,1381,-$-,73508,,011,100232390,XXXXXXXXX,,,,,000100098383,1,,087
ON,COMPRA,031213,192512,DEB ,VISA DEBITO,4517********7200,B,388301,1382,-$-,64819,XXX,001,13872437,XXXXXXXXX,,,,,000100098303,1,,087
ON,COMPRA,031213,202018,CRED,NARANJA,5895********5038,B,882342,1383,-$-,99580,,011,100232390,XXXXXXXXX,,,,,000100098320,1,,087
ON,COMPRA,031213,202440,CRED,NARANJA,5895********5038,B,506880,1384,-$-,95699,,011,100232390,XXXXXXXXX,,,,,000100098321,1,,087
ON,COMPRA,031213,204556,CRED,VISA,4509********7459,C,006348,1385,-$-,99624,,001,13872437,XXXXXXXXX,,,,,000100098325,1,,087
ON,COMPRA,031213,205046,CRED,VISA,4509********7459,C,009335,1386,-$-,40529,,001,13872437,XXXXXXXXX,,,,,000100098326,1,,087
ON,COMPRA,031213,205633,DEB ,VISA DEBITO,4517********3009,B,823726,1387,-$-,99492,XXX,001,13872437,XXXXXXXXX,,,,,000100098327,1,,087
ON,COMPRA,031213,210104,DEB ,VISA DEBITO,4517********3009,B,134478,1388,-$-,63493,XXX,001,13872437,XXXXXXXXX,,,,,000100098328,1,,087
ON,COMPRA,031213,210602,DEB ,VISA DEBITO,4517********3756,B,769375,1389,-$-,58578,XXX,001,13872437,XXXXXXXXX,,,,,000100023666,1,,087
ON,COMPRA,031213,211020,CRED,NARANJA,5895********5131,B,404025,1390,-$-,36509,,011,100232390,XXXXXXXXX,,,,,000100098330,1,,087
1,0,POSNET,061,002,011213,XXXXXXXXX
ON,COMPRA,011213,133940,DEB ,MC DEBIT,5118********6001,B,406026,0315,-$-,99336,XXX,001,08682581,XXXXXXXXX,,,,,000100072039,0,000,061
ON,COMPRA,011213,134522,CRED,KADICARD,6271********1218,B,082226,0316,-$-,99468,,001,01448701,XXXXXXXXX,,,,,000100072040,0,,061
1,1,VISA -$-,075,012,011213,XXXXXXXXX
ON,COMPRA,011213,104851,CRED,VISA,4509********9926,B,005089,0484,-$-,12076,,001,13872437,XXXXXXXXX,,,,,000100071997,1,,075
ON,COMPRA,011213,122008,DEB ,VISA DEBITO,4517********3485,B,939488,0485,-$-,99323,XXX,001,13872437,XXXXXXXXX,,,,,000100072022,1,,075
ON,COMPRA,011213,124856,CRED,NARANJA,5895********5116,B,366178,0486,-$-,98988,,001,100232390,XXXXXXXXX,,,,,000100072028,1,,075
ON,COMPRA,011213,125626,DEB ,VISA DEBITO,4517********7108,B,267992,0487,-$-,97870,XXX,001,13872437,XXXXXXXXX,,,,,000100072030,1,,075
ON,COMPRA,011213,130807,CRED,NARANJA,5895********1038,B,243475,0488,-$-,99293,,011,100232390,XXXXXXXXX,,,,,000100072033,1,,075
ON,COMPRA,011213,131354,CRED,NARANJA,5895********1038,B,702844,0489,-$-,99501,,011,100232390,XXXXXXXXX,,,,,000100072034,1,,075
ON,COMPRA,011213,131811,CRED,NARANJA,5895********1038,B,102804,0490,-$-,99628,,011,100232390,XXXXXXXXX,,,,,000100072035,1,,075
ON,COMPRA,011213,132301,CRED,NARANJA,5895********1038,B,491908,0491,-$-,99053,,011,100232390,XXXXXXXXX,,,,,000100072036,1,,075
ON,COMPRA,011213,132915,CRED,NARANJA,5895********1038,B,744431,0492,-$-,99417,,011,100232390,XXXXXXXXX,,,,,000100072037,1,,075
ON,COMPRA,011213,133318,CRED,NARANJA,5895********1038,B,025915,0493,-$-,99670,,011,100232390,XXXXXXXXX,,,,,000100072038,1,,075
ON,COMPRA,011213,140031,CRED,VISA,4546********2595,B,005344,0494,-$-,99062,,001,13872437,XXXXXXXXX,,,,,000100072043,1,,075
ON,COMPRA,011213,140235,CRED,VISA,4546********2595,B,006378,0495,-$-,17025,,001,13872437,XXXXXXXXX,,,,,000100072044,1,,075
1,1,VISA -$-,076,003,031213,XXXXXXXXX
ON,COMPRA,031213,120327,CRED,NARANJA,5895********0040,B,070488,0496,-$-,98761,,011,100232390,XXXXXXXXX,,,,,000100072067,1,,076
ON,COMPRA,031213,120703,CRED,NARANJA,5895********0040,B,078039,0497,-$-,97159,,011,100232390,XXXXXXXXX,,,,,000100072068,1,,076
ON,COMPRA,031213,121116,CRED,NARANJA,5895********8012,B,001893,0498,-$-,78879,,011,100232390,XXXXXXXXX,,,,,000100072069,1,,076
1,0,POSNET,150,012,031213,XXXXXXXXX
ON,COMPRA,031213,182819,DEB ,MAESTRO,5010**********9007,B,001854,1476,-$-,98235,CAP,001,08682581,XXXXXXXXX,,,,,000100160919,0,000,150
ON,COMPRA,031213,183237,DEB ,MAESTRO,5010**********9007,B,001855,1477,-$-,96407,CAP,001,08682581,XXXXXXXXX,,,,,000100160920,0,000,150
ON,COMPRA,031213,183745,DEB ,MAESTRO,5010**********9007,B,001856,1478,-$-,94864,CAP,001,08682581,XXXXXXXXX,,,,,000100160921,0,000,150
ON,COMPRA,031213,184202,DEB ,MAESTRO,5010**********9007,B,001857,1479,-$-,59875,CAP,001,08682581,XXXXXXXXX,,,,,000100160922,0,000,150
ON,COMPRA,031213,194723,DEB ,MAESTRO,5010***********2560,B,001858,1480,-$-,97797,CAP,001,08682581,XXXXXXXXX,,,,,000100160934,0,000,150
ON,COMPRA,031213,195127,DEB ,MAESTRO,5010***********2560,B,001859,1481,-$-,48616,CAP,001,08682581,XXXXXXXXX,,,,,000100160935,0,000,150
ON,COMPRA,031213,200249,CRED,MC-BANCOR,5427********7265,B,029065,1482,-$-,97047,,003,12867312,XXXXXXXXX,,,,,000100160937,0,020,150
ON,COMPRA,031213,200517,CRED,MC-BANCOR,5427********7265,B,909395,1483,-$-,11039,,003,12867312,XXXXXXXXX,,,,,000100160938,0,020,150
ON,COMPRA,031213,201224,CRED,MC-BANCOR,5427********9810,B,188294,1484,-$-,65309,,003,12867312,XXXXXXXXX,,,,,000100160939,0,020,150
ON,COMPRA,031213,203034,DEB ,MC DEBIT,5118********0006,B,534411,1485,-$-,24341,XXX,001,08682581,XXXXXXXXX,,,,,000100160942,0,000,150
ON,COMPRA,031213,211121,DEB ,MAESTRO,5010**********7008,B,001864,1486,-$-,98051,CAP,001,08682581,XXXXXXXXX,,,,,000100160950,0,000,150
ON,COMPRA,031213,211627,DEB ,MAESTRO,5010**********7008,B,001865,1487,-$-,92627,CAP,001,08682581,XXXXXXXXX,,,,,000100160951,0,000,150
1,1,VISA -$-,148,015,031213,XXXXXXXXX
ON,COMPRA,031213,170423,DEB ,VISA DEBITO,4517********7143,B,538991,1849,-$-,98066,XXX,001,13872437,XXXXXXXXX,,,,,000100160904,1,,148
ON,COMPRA,031213,171013,DEB ,VISA DEBITO,4517********7143,B,688032,1850,-$-,98713,XXX,001,13872437,XXXXXXXXX,,,,,000100160905,1,,148
ON,COMPRA,031213,171138,DEB ,VISA DEBITO,4517********7143,B,011811,1851,-$-,13405,XXX,001,13872437,XXXXXXXXX,,,,,000100160906,1,,148
ON,COMPRA,031213,192729,DEB ,VISA DEBITO,4517********5553,B,625848,1852,-$-,38898,XXX,001,13872437,XXXXXXXXX,,,,,000100160930,1,,148
ON,COMPRA,031213,193957,DEB ,VISA DEBITO,4517********3668,B,339949,1853,-$-,96853,XXX,001,13872437,XXXXXXXXX,,,,,000100160933,1,,148
ON,COMPRA,031213,201757,CRED,NARANJA,5895********4045,B,386760,1854,-$-,87648,,011,100232390,XXXXXXXXX,,,,,000100160940,1,,148
ON,COMPRA,031213,202457,CRED,NARANJA,5895********7121,B,190858,1855,-$-,51185,,011,100232390,XXXXXXXXX,,,,,000100160941,1,,148
ON,COMPRA,031213,203734,DEB ,VISA DEBITO,4517********9180,B,233227,1856,-$-,84207,XXX,001,13872437,XXXXXXXXX,,,,,000100160943,1,,148
ON,COMPRA,031213,204229,CRED,VISA,4509********2510,B,008306,1857,-$-,95789,,001,13872437,XXXXXXXXX,,,,,000100160944,1,,148
ON,COMPRA,031213,204847,CRED,VISA,4509********1674,B,006406,1858,-$-,95016,,001,13872437,XXXXXXXXX,,,,,000100160945,1,,148
ON,COMPRA,031213,205222,CRED,VISA,4509********1674,B,010646,1859,-$-,98712,,001,13872437,XXXXXXXXX,,,,,000100160946,1,,148
ON,COMPRA,031213,205421,CRED,VISA,4509********1674,B,055662,1860,-$-,18611,,001,13872437,XXXXXXXXX,,,,,000100160947,1,,148
ON,COMPRA,031213,213245,DEB ,VISA DEBITO,4517********3589,B,777200,1861,-$-,98584,XXX,001,13872437,XXXXXXXXX,,,,,000100160954,1,,148
ON,COMPRA,031213,214126,CRED,NARANJA,5895********9033,B,322053,1862,-$-,83593,,011,100232390,XXXXXXXXX,,,,,000100160955,1,,148
ON,COMPRA,031213,214338,CRED,NARANJA,5895********9033,B,942426,1863,-$-,65370,,001,100232390,XXXXXXXXX,,,,,000100160956,1,,148