Breplace

From Scriptwiki
Revision as of 19:35, 13 October 2006 by Vliedel (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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.