>GO top >SCAN WHILE .NOT. EOF() >A=A+" "+ALLTRIM(ps) >ENDSCAN >STRTOFILE(a,'1.ps',.F.) >>
>>Local lcFile, lcText >>m.lcFile = [temp\test.ps] >>Create Cursor dummy (PS c(254), pos i) >>Append From (m.lcFile) Sdf >>Scan >> If Getwordnum(PS, Getwordcount(PS)) = [w] >> m.lcText = Getwordnum(PS, Getwordcount(PS) - 1) && The second last word >> If Len(Chrtran(m.lcText, [1234567890], [])) = 0 && lcText contains only digits >> Replace pos With Val(m.lcText) >> Endif >> Endif >>Endscan >>>>This will give you a table where the value you want to check is in a separate field. Now you can calculate the values you want, and replace them in the fields. To create the fixed file, you scan the file and use strtofile().
>>>U1 >>>%%Page: 2 2 >>><</Duplex true /Tumble false /ManualFeed false /MediaPosition 1>> setpagedevice >>>g n >>>/Fn3{d I/ArialBlack F}b/F12{/I 15.0 Fn3}b >>>F12 B (BHARAT SANCHAR NIGAM LIMITED)301 805 y >>>G >>>1 w1 594 774 2 774 L >>>g n >>>F2 B (Account Number 1010467969)13 789 w >>>G >>>g n >>>F2 B (Invoice Number 10104679690030)580 789 x >>>G >>>g n >>>F2 B (Invoice Date 05/09/2012)229 789 w >>>G >>>g n >>>/F13{/I 7.4 Fn2}b >>>F13 B (Page 2)496 16 w >>>G >>> g g n >>>/F15{/I 7.5 Fn2}b >>>F15 B (of 4)532 16 w >>>G >>>G >>>N 36 766 534 -8 i >>>F8 B (Recurring Charges)38 759 w >>>(Product)38 749 w >>>(Plan)195 749 w >>>(Period)352 749 w >>>(Qty)442 749 x >>>(Rate)481 749 x >>>(Charges)568 749 x >>>F9 (DISCOUNT)38 737 w >>>(LO-KAR-LO-BAAT-OTHER)195 737 w >>>(01/08/12 to 31/08/12)352 737 w >>>(NA)442 737 x >>>(NA)481 737 x >>>(149.00)568 737 x >>>F8 (Total Charges \(Rs.\))38 726 w >>>(149.00)568 726 x >>>N 36 715 534 -8 i >>>B (Usage Charges)38 708 w >>>(Phone Calls)38 699 w >>>(Units)258 699 w >>>(Duration/Volume)321 699 w >>>(Gross Amt)443 699 x >>>(Discount)505 699 x >>>(Net Amt)568 699 x >>>F9 (Local Cellular)38 688 w >>>(407)258 687 w >>>(07:29:06)321 687 w >>>(407.00)443 687 x >>>(372.00)505 687 x >>>(35.000)568 687 x >>>(Local LL BSNL)38 676 w >>>(460)258 675 w >>>(04:36:43)321 675 w >>>(312.00)443 675 x >>>(312.00)505 675 x >>>(0.000)568 675 x >>>(Special Number Band 3)38 664 w >>>(2)258 663 w >>>(00:01:27)321 663 w >>>(2.00)443 663 x >>>(0.00)505 663 x >>>(2.000)568 663 x >>>(Special Number Band 8)38 652 w >>>(70)258 652 w >>>(00:57:47)321 652 w >>>(0.00)443 652 x >>>(0.00)505 652 x >>>(0.000)568 652 x >>>(Local Landline BSNL)38 640 w >>>(1)258 640 w >>>(00:01:20)321 640 w >>>(1.00)443 640 x >>>(1.00)505 640 x >>>(0.000)568 640 x >>>(STD Cellular)38 629 w >>>(2)258 628 w >>>(00:01:44)321 628 w >>>(2.00)443 628 x >>>(0.00)505 628 x >>>(2.000)568 628 x >>>(STD Intra Circle GT50 BSNL)38 617 w >>>(1)258 616 w >>>(00:00:11)321 616 w >>>(1.00)443 616 x >>>(1.00)505 616 x >>>(0.000)568 616 x >>>F8 (Total Charges \(Rs.\))38 604 w >>>(725.00)443 604 x >>>(686.00)505 604 x >>>(39.00)568 604 x >>>/Fn4{d I/Arial-Italic F}b/F14{/I 6.3 Fn4}b >>>F14 (For BB 1 Unit = 1 KB)38 595 w >>>N 36 586 534 -8 i >>>F8 B (Discounts)38 579 w >>>(Discount Type)38 570 w >>>(Period)258 570 w >>>(Discounts)568 570 x >>>F9 (LL-FREE-CALLS-50-1)38 558 w >>>(01/08/12 to 31/08/12)258 558 w >>>(-39.00)568 558 x >>>(LO-KAR-LO-BAAT)38 546 w >>>(01/08/12 to 31/08/12)258 546 w >>>(0.00 - 686.00 Units@100.00%)38 534 w >>>(-686.00)568 534 x >>>F8 (Total Discounts \(Rs.\))38 523 w >>>(-725.00)568 523 x >>>g n >>>F2 B (Plan FRIENDS-AND-FAMILY)13 775 w >>>G >>>g n >>>F2 B (Phone Number / UserName 0731-2459292)580 775 x >>>G >>>U1 >>>