Quick way to extract data from multiples lines and many files using jrepl?
Posted: 07 Aug 2017 03:11
I would like to extract all values of which from hundred files but only when it is a parameter of set_variable or change_variable. These functions can be on one line or several. Commented functions are excluded.
Example:
Correct values:
current_potion_quality
laws
debate_score
My script works fine, but it is excruciatingly long (At least 10 minutes):
/m (multilines parameter) seems to be the cause, the rest of the script being fast.
Any ideas ?
Thanks.
Example:
Code: Select all
ROOT = {
change_variable = {
which = current_potion_quality
value = 1
}
}
change_variable = { which = "laws" value = 1 }
change_variable = { value = -1 which = debate_score }
bad_function = { which = not_a_value }
#change_variable = { value = -1 which = not_a_value }
Correct values:
current_potion_quality
laws
debate_score
My script works fine, but it is excruciatingly long (At least 10 minutes):
Code: Select all
for %%F in ("C:\game\decisions\*.txt") do (
call BATCH_JREPL "(^[^#]*?)(\b(set_variable|change_variable)\s*=)([\s\S]*?)(which\s*=\s*\q?)([A-Za-z0-9_]+)" "$txt=$6" /jmatchq /x /m /f "%%F" >> "TEMP\ztemp0_all_variables.txt"
for %%F in ("C:\game\events\*.txt") do (
call BATCH_JREPL "(^[^#]*?)(\b(set_variable|change_variable)\s*=)([\s\S]*?)(which\s*=\s*\q?)([A-Za-z0-9_]+)" "$txt=$6" /jmatchq /x /m /f "%%F" >> "TEMP\ztemp0_all_variables.txt"
)
/m (multilines parameter) seems to be the cause, the rest of the script being fast.
Any ideas ?
Thanks.