如何将字符串添加到与我的模式匹配的目录中的每个文件?

voo*_*ooD 2 linux bash scripting

我正在尝试将 require_once 'bootstrap.php';字符串添加到schema.yml特定目录中的每个文件.我是linux新手.有人能告诉我one-line-magic-command吗?

任何帮助非常感谢!

编辑 我需要递归搜索schema.yml.

dog*_*ane 6

使用sed:

find somedir -name schema.yml | xargs sed -i "1i require_once 'bootstrap.php';"
Run Code Online (Sandbox Code Playgroud)