Difference between revisions of "Breplace"

From Scriptwiki
Jump to: navigation, search
m
 
m
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
The breplace command is used to replace values in a [[:Category:Binary Files|binary file]].
 
The breplace command is used to replace values in a [[:Category:Binary Files|binary file]].
 
  <nowiki>breplace <&binvar> <oldvalue> <newvalue> [oldvalue newvalue...]</nowiki>
 
  <nowiki>breplace <&binvar> <oldvalue> <newvalue> [oldvalue newvalue...]</nowiki>
This replaces all matching [[$asc|asciivalues]] of the binary file &binvar to the new values.
+
This replaces all matching [[$asc|asciivalues]] of the binary file ''&binvar'' to the new values.
  
 
== Examples ==
 
== Examples ==
 
  [[bset]] 1 &test 65 66 67 68 69 65 66
 
  [[bset]] 1 &test 65 66 67 68 69 65 66
 
  breplace &test 65 97 66 98
 
  breplace &test 65 97 66 98
  [[echo]] -a [[$bvar]](&test,1,$bvar(&test,0))
+
  [[echo]] -a [[$bvar]](&test,1,$bvar(&test,0)) returns ''97 98 67 68 69 97 98''
''97 98 67 68 69 97 98''
 
 
This replaced all values 65 to 97 and all values 66 to 98.
 
This replaced all values 65 to 97 and all values 66 to 98.
  
 
  bset 1 &test 65 66 67 68 69 65 66
 
  bset 1 &test 65 66 67 68 69 65 66
 
  breplace &test 65 66 66 98
 
  breplace &test 65 66 66 98
  echo -a $bvar(&test,1,$bvar(&test,0))
+
  echo -a $bvar(&test,1,$bvar(&test,0)) returns ''66 98 67 68 69 66 98''
''66 98 67 68 69 66 98''
 
 
This replaced all values 65 to 66 and all values that were 66 to 98. Notice that the values that were 65 and replaced to 66 are not replaced to 98.
 
This replaced all values 65 to 66 and all values that were 66 to 98. Notice that the values that were 65 and replaced to 66 are not replaced to 98.
  
 
[[Category:Binary Files]]
 
[[Category:Binary Files]]
 
[[Category:Commands]]
 
[[Category:Commands]]

Latest revision as of 19:35, 13 October 2006

The breplace command is used to replace values in a binary file.

breplace <&binvar> <oldvalue> <newvalue> [oldvalue newvalue...]

This replaces all matching asciivalues of the binary file &binvar to the new values.

Examples

bset 1 &test 65 66 67 68 69 65 66
breplace &test 65 97 66 98
echo -a $bvar(&test,1,$bvar(&test,0)) returns 97 98 67 68 69 97 98

This replaced all values 65 to 97 and all values 66 to 98.

bset 1 &test 65 66 67 68 69 65 66
breplace &test 65 66 66 98
echo -a $bvar(&test,1,$bvar(&test,0)) returns 66 98 67 68 69 66 98

This replaced all values 65 to 66 and all values that were 66 to 98. Notice that the values that were 65 and replaced to 66 are not replaced to 98.