hi monks,
U copy chandu.txt and guidpair.txt and try Chandu.txt is one file ->(below one)->file1 <here is my code>

5C1DAEF0-9386-44a5-B92A-31FE2C79236A 746B97B8-486A-094F-9426292F0C0BB644 7b8f231e-7176-45cc-94d7-083813b25da7 F1DD19D9-FE2A-7949-905A194FF091E251 7A46C182-8120-B94E-805DFAF46182136C 5F146C81-330A-854F-891B0D577D8801E2

I have to replace

Guidpair.txt is one file -> second file -> "Web","rad","INPUT","onclick","746B97B8-486A-094F-9426292F0C0BB644 F",""

Here I have to replace -> 746B97B8-486A-094F-9426292F0C0BB644 F from guidpair.txt to 5C1DAEF0-9386-44a5-B92A-31FE2C79236A (chandu.txt)

After that I have to store back to same place

Guidpair.txt file this one (below)-> file2
"Special","URL","","","http://10.0.1.49/ui/view_cx_login.php","" "Web","username","INPUT","onclick","","" "Web","username","INPUT","onfocusout","admin","" "Web","password","INPUT","onclick","","" "Web","password","INPUT","onfocusout","password","" "Web","submit_login","INPUT","onclick","Login","" "Special","URL","","","http://10.0.1.49/ui/do_local_replication.php"," +" "Web","onclick","B","onclick"," IMID-VKISHORE","" "Web","rad","INPUT","onclick","746B97B8-486A-094F-9426292F0C0BB644 F", +"" "Web","rad","INPUT","onfocusout","746B97B8-486A-094F-9426292F0C0BB644 +F","" "Web","Submit","INPUT","onclick","Start Replication","" "Web","onclick","B","onclick"," IMITS018","" "Web","dest","INPUT","onclick","F1DD19D9-FE2A-7949-905A194FF091E251 Z" +,"" "Web","dest","INPUT","onfocusout","F1DD19D9-FE2A-7949-905A194FF091E251 + Z","" "Web","ftps_source_secure_channel","INPUT","onclick","0","" "Web","ftps_source_secure_channel","INPUT","onfocusout","0","" "Web","ftps_dest_secure_channel","INPUT","onclick","0","" "Web","ftps_dest_secure_channel","INPUT","onfocusout","0","" "Web","fast_resync","INPUT","onclick","0","" "Web","fast_resync","INPUT","onfocusout","0","" "Web","submit","INPUT","onclick","Submit","" "Web","Logout","A","onclick","ui/view_cx_login.php",""

Task I done is this one

open (FILE1,'< chandu.txt'); open (FILE2,'+< guidpair.txt') or die("Can't open guidpair: $!"); while($b=<FILE1>) { print $b; $file=$b; while($a=<FILE2>) { if($a=~m/onclick/ && $a=~m/\w+-\w+-\w+-\w+\s\D/) { print $a; seek(FILE2,-127, 1); $a=~s/\w+-\w+-\w+-\w+\s\D/$file/; print FILE2 "$a \n"; } } } close(FILE1); close(FILE2);

20060717 Janitored by Corion: Added formatting, code tags, as per Writeup Formatting Tips


In reply to how to match the pattern by using regexp for the below task by Anonymous Monk

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.