Another user helped me earlier to fix something I'm doing with awk, where I search for a string at any point in all files and replace two numbers in the same line when I find it.
awk -i inplace '/^gene_height/{ $3=sprintf("%.0f",(169+rand()*51));$5=sprintf("%.0f",(169+rand()*51)) }1' *
This worked in the test files that I made (much fewer tags to read), but then in the actual files I'm trying to change for a Crusader Kings mod it's getting blocked because each line in the config file starts with a space then two tabs. I tried removing the "^" before gene_height and that kind of works, but it removes the space and two tabs from the file which might mess up the format and break the mod.
Does anyone know how I can get the above script to read files that start with a space, two tabs, THEN the string "gene_height", and keep the space and two tabs when doing the replacement?