The challenge of my task is that the file.txt can be in subfolder or in sub-sub folders. The general structure looks like this:
   folder
     |___subfolder
             |_____file.txt
     |
     |___subfolder
             |____subfolder
                      |_______file.txt
     etc
My previous code does not deal with the sub-sub folder and I am not sure how to add in this part (since some sub folder does not have any subsequent folders)
 for dir in ./*/ ; do
        if [ -d "$dir" ]; then 
           cd $d;
           for subdir in ./*/; do
               cd $subdir && $(sed command file.txt) && cd ..;
           done
           cd ..
        fi
done
I have also learned there's a one line method of using find, something like:
find . -name 'file.txt' | sed command file.txt
Apparently this one doesn't work as find only returns the dir to my file.txt