in reply to Re: Unknow number show up
in thread Unknow number show up

Dear Ed,

When I replace "system" with "print" in my code as you mentioned, it just now working in the sense that nothing happen to my output file. While in command prompt window it give me this type of display

perl -pi.bak -e s/WL0,BL195(?=,)/WL0,BL195,1708/g; CombineDie1Die2.txt perl -pi.bak -e s/WL0,BL196(?=,)/WL0,BL196,1708/g; CombineDie1Die2.txt perl -pi.bak -e s/WL0,BL197(?=,)/WL0,BL197,1931/g; CombineDie1Die2.txt perl -pi.bak -e s/WL0,BL198(?=,)/WL0,BL198,1931/g; CombineDie1Die2.txt

I am facing another problem now as my file 1 is about 8 millions line and same as file 2. It took around 3~4 hours only process thousand line. I need a solution for this. Appreciate if you can help.

Replies are listed 'Best First'.
Re^3: Unknow number show up
by flexvault (Monsignor) on Apr 13, 2015 at 17:44 UTC

    Dear Vkhaw,

    The 'print' was to help you see what your 'system' call was doing, not to fix your problem. You have some excellent suggestions from other posters, integrate their suggestions and then post additional questions.

    My current suggestion is to take some time to better understand your file inputs. ie:

    • Are the files sorted in any way? Could they be sorted for performance?
    • Can file2 be loading into an array in memory? That way you read the file once before the loop and then inside the loop, you read file1 a line at a time...Much faster!
    • Do your 's///' directly without re-calling Perl! Much, much faster!
    And please keep asking questions, that's how we all learned!

    Regards...Ed

    "Well done is better than well said." - Benjamin Franklin