I want to change in several txt-files a variable. But this variable shouldn't be equal in every txt-file. I tried this, but it doesn't work.
for file in ./*.txt ;do
for value in $(seq 1 5); do
sed -i 's/x_max=.*/x_max='$value'/ ' $file
done
done
So every x_max has got the value:5
sedruns incrementing at every iteration. since the file is being over-written, every file will havex_max=5.