Suppose I have a sequence of directories ~/dir1, ~/dir2, ..., ~/dirN and in each of these directories there exists a file file.txt. Suppose that file.txt contains a variable myval and that in each instance of file.txt, I want to change the value of myval. For example, suppose I want to modify the copy of file.txt in dirN such that myval takes on the value N.
Is this something that I can reasonably do with a for loop on the command line?