将logcat打印到使用过滤器的文件?使用GREP?

发布于 2025-01-26 15:58:43 字数 336 浏览 2 评论 0原文

我很容易通过这样做来打印我的logcat以提交文件:

Process process = Runtime.getRuntime().exec( "logcat -f test.txt");

但是我想根据匹配的单词过滤内容,我考虑使用grep和操作员>打印要文件,但这无效。没有创建文件。

Process process = Runtime.getRuntime().exec("logcat -d | grep -n \"System.out\" > test.txt");

I am very easily printing my logcat to file by doing this:

Process process = Runtime.getRuntime().exec( "logcat -f test.txt");

But I would like to filter the content based on matching words, I thought about using grep and the operator >to print to file but that didn't work. No file is being created.

Process process = Runtime.getRuntime().exec("logcat -d | grep -n \"System.out\" > test.txt");

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文