Open tianyagongcishi opened 10 years ago
There is not a way to do that at the moment. One issue is that one replacement pattern could affect the follow on patterns, so the must be done in order.
This feature is totally needed. It will be very useful for obfuscating code. Currently it can take tokens from file and also it can replace them with contents of another file (-F) so remaining change is to take replacements accordingly line-to-line from it. For exapmle:
grasp -f tokens.txt -replace_per_line repl.txt -i input.js
tokens.txt:
repl.txt: aaa bbb ccc
will be same as: grasp #a -R aaa -i input.js grasp #b -R bbb -i input.js grasp #c -R ccc -i input.js
let it even be slow but this is needed for convenience.
if i want to replace many variables in a js file,i can write many command like below: grasp '#a' -R aaa -i a.js grasp '#b' -R bbb -i a.js grasp '#c' -R ccc -i a.js grasp '#d' -R ddd -i a.js ... ...
a.js is very big(>=1MB),so it's very slow,is there a faster way?