60 How to change line in all files in tree?

Suppose we wanted to replace text in any line in files in some tree.

Do

#!/bin/bash 
 
cd $HOME/my_tree 
 
find . -name "fricas_listA.txt"|while read fname; do 
  echo "processing $fname" 
  sed -i 's/algorithm="fricas"/algorithm=""fricas""/g'  $fname 
done
 

The above replaces algorithm="fricas" by algorithm=""fricas"" everywhere in all files called fricas_listA.txt in the tree. To apply this to all text file, replace -name "fricas_listA.txt" by -name "*.txt"