jumdesumit has asked for the wisdom of the Perl Monks concerning the following question:
I need a Perl Code to transfer a pattern from file1 to file 2.I have two files one of them is a text file where I have pattern stored in in binary format, and another one is ASCII file where I have to transfer data.The pattern should be placed only after wor "PI" in ASCII file.
For eg :
File 1(.txt)-
Result is : 10000000 10000000 10000000 10000000 10000 +000 00000011 00000011 00000011 00000011 00000011 10000001 10000001 10000001 10000001 10000001 11000000 11000000 11000000 11000000 11000000 01100000 01100000 01100000 01100000 01100000
File 2(ascii)-
CHAIN_TEST = pattern = 0; apply "grp1_load" 0 = chain "chain1" = "010"; end; force "PI" "XX0XXXXXX" 1; measure "PO" "XX" 2; apply "grp1_unload" 3 = chain "chain1" = "010"; end; pattern = 1; apply "grp1_load" 0 = chain "chain1" = "101"; end; force "PI" "XX0XXXXXX" 1; measure "PO" "XX" 2; apply "grp1_unload" 3 = chain "chain1" = "101"; end; end; SCAN_TEST = pattern = 0; apply "grp1_load" 0 = chain "chain1" = "010"; end; force "PI" "100000000" 1; measure "PO" "10" 2; pulse "/CK" 3; apply "grp1_unload" 4 = chain "chain1" = "010"; end; pattern = 1; apply "grp1_load" 0 = chain "chain1" = "110"; end; force "PI" "110000101" 1; measure "PO" "11" 2; pulse "/CK" 3; apply "grp1_unload" 4 = chain "chain1" = "100"; end; pattern = 2; apply "grp1_load" 0 = chain "chain1" = "001"; end; force "PI" "010000110" 1; measure "PO" "10" 2; pulse "/CK" 3; apply "grp1_unload" 4 = chain "chain1" = "010"; end;
2018-01-26 Athanasius added code and paragraph tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Pattern transfer
by haukex (Archbishop) on Jan 24, 2018 at 13:46 UTC | |
|
Re: Pattern transfer
by tybalt89 (Monsignor) on Jan 26, 2018 at 13:39 UTC | |
|
Re: Pattern transfer
by hippo (Archbishop) on Jan 24, 2018 at 13:46 UTC |