Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how to match the pattern by using regexp for the below task
by shmem (Chancellor) on Jul 17, 2006 at 08:19 UTC | |
|
Re: how to match the pattern by using regexp for the below task
by cdarke (Prior) on Jul 17, 2006 at 07:51 UTC | |
|
Re: how to match the pattern by using regexp for the below task
by rsiedl (Friar) on Jul 17, 2006 at 07:00 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |