[英]How can I pipe the output of 'find' into a command that will execute 'more' piped into 'grep' on package.json two directories up?
I am trying to find which package.json is causing a dependency warning.我试图找到哪个 package.json 导致依赖警告。 It's coming from a sub-module.
它来自一个子模块。 I have a find command
find . -name 'foo'
我有一个 find 命令
find . -name 'foo'
find . -name 'foo'
that outputs find . -name 'foo'
输出
/a/very/very/very/long/path/to/a/submodule/.../node_modules/foo
/another/very/very/very/long/path/to/a/submodule/.../node_modules/foo
I want to see what version of foo is included in the parent module's package.json.我想看看父模块的 package.json 中包含了哪个版本的 foo。 Something like this
像这样的东西
more "$find_output"/../../package.json | grep foo
弄清楚了:
find . -name 'foo' -print0 | xargs -0 bash -c 'for path; do more "$path"/../../package.json | grep "foo"; echo $path; done ' bash
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.