newbie10 has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks, I wanted a script to modify the contents of another file from one file eg: I have a document of html+jquery which consist of certain no., I want a script to update those no. when I run the perl script..

Replies are listed 'Best First'.
Re: File parsing
by Discipulus (Canon) on Sep 08, 2015 at 10:01 UTC
    hello and welcome newbie10,

    modify a text file is a trivial task, you can start with perl -i.
    Additionally you'll find that more effort you put writing question, containing what you tried, example data and so on, more chance you'll have to get good answers in return.
    Also remember that Super Search is your friend

    L*
    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Re: File parsing
by CountZero (Bishop) on Sep 08, 2015 at 15:18 UTC
    A general question merits a general answer.

    In outline, you can do the following:

    1. Obtain the text in a format readable and writabel by Perl (or any other programming language or tool you want to use)
    2. Read the file and find the parts that need to be replaced.
    3. Perform the replacement.
    4. Write the edited text back to a file.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

    My blog: Imperial Deltronics
Re: File parsing
by Laurent_R (Canon) on Sep 08, 2015 at 12:47 UTC
    Hi,

    your question is too general, I'm afraid we can't help you very much if you don't supply additional details, such as samples of your input files and of the desired output, sample of the code you have already written if any, etc.

Re: File parsing
by locked_user sundialsvc4 (Abbot) on Sep 08, 2015 at 13:03 UTC

    Indeed.   “HTML plus JQuery is not merely a file:   it is a computer program.   To (merely) describe it to u as “consisting of certain numbers” strongly implies that the “numbers” actually reside somewhere else ... a database, perhaps? ... and that this “HTML plus JQuery” that you have is, in effect, the source-code to a computer program that obtains and displays the data (from somewhere).

    Step back, please, and describe the entire problem to us as best you can.   What is this web-page?   Can we see it somewhere on the web?   What is the nature of the file that describes the “modifications” that you wish to do, and what sort of modifications are they?

    What you have now is what is called an XY Problem.   This is undoubtedly not a “file parsing” task at all.   We are happy to help you to get on the right track with this, and to get it done.