find . -name "*.bb" -type f -exec grep -H "SRC_URI" {} \; | cut -d "=" -f2 | sed 's/^[ \t]*//;s/[ \t]*$//' >> git.txt
时间: 2024-06-06 18:06:49 浏览: 14
This command searches for all files with the .bb extension in the current directory and its subdirectories, and then searches for the string "SRC_URI" in each of these files. It then extracts the value of the "SRC_URI" key using the cut command and removes any leading or trailing whitespace using the sed command. Finally, it appends the extracted values to the file "git.txt".
相关问题
find .-name "*.cpp" |xargs grep -r "hello"
这是一个 Linux 命令,含义是在当前目录及其子目录中查找所有扩展名为 .cpp 的文件,并在这些文件中搜索包含字符串 "hello" 的行。
具体解释如下:
- `find . -name "*.cpp"`:在当前目录及其子目录中查找所有扩展名为 .cpp 的文件。
- `|`:将上一个命令的输出作为下一个命令的输入。
- `xargs grep -r "hello"`:将上一步查找到的所有文件作为参数传递给 grep 命令,并在这些文件中搜索包含字符串 "hello" 的行。其中 `-r` 参数表示递归搜索子目录。
find . -type f -name "lvs.cmd" | grep -il "ATTACH"为什么不输出路径?
这个命令的作用是在当前目录及其子目录中查找文件名为"lvs.cmd"且内容中包含"ATTACH"的文件。但是,它没有输出路径的原因可能是因为找不到符合条件的文件。
请确保在运行该命令之前,你已经进入到正确的目录,并且当前目录及其子目录中确实存在名为"lvs.cmd"且内容中包含"ATTACH"的文件。
另外,你可以尝试添加 `-print` 参数来显示文件的路径,例如:
```
find . -type f -name "lvs.cmd" | grep -il "ATTACH" -print
```
这样会将符合条件的文件路径输出出来。
相关推荐
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)