how to fix the values of file2 in the file1?

There may be some misunderstanding... You cannot "fix file1". You must make a new file which is the "fixed" version of file1. Then you can adjust the file names such that this new file replaces the existing file1.

Stuff like say some area number cannot be directly added into file1(i.e., area=1234). The file on disk is literally a very long string of bits. You can't add more bits between say bit #38 and bit #39 without overwriting what was in bits #39,40,...etc. Think of an old cassette tape with 5 songs. You can't add a new song #6 between song 2 and 3 without rewriting songs 3,4,5.

cdarke's post is the correct method for this procedure.

So, you have the general idea of what needs to be done. Write some code and report back with it and specific questions.


In reply to Re: Updating the files with data from another file by Marshall
in thread Updating the files with data from another file by amitsh

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.