尝试grep日志文件时出现行太长错误 [英] line too long error when trying to grep log files

查看:74
本文介绍了尝试grep日志文件时出现行太长错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在shell提示符下键入此命令时:

When I type this at shell prompt:

grep -r  "ambiguously" .

我得到了错误:

grep:行太长.

grep: line too long.

基本上,当前目录是一个日志目录,我正在尝试在所有日志文件中找到sql错误歧义定义的列".

Basically the current directory is a log directory and I am trying to locate the sql error 'Column ambiguously defined' in all the log files.

但是为什么会出现错误?文件很大,是主要原因吗?

But why do I get the error? The files are very huge in size, is that the main reason?

推荐答案

您应该尝试

find -type f -exec grep PATTERN {} +

命令行限制可以在Linux上找到,

The command line limitation can be found on linux with

$ getconf ARG_MAX

在* BSD上

$ sysctl kern.argmax

请参见 http://www.cyberciti.biz/常见问题解答/参数列表过长的错误解决方案/.

这篇关于尝试grep日志文件时出现行太长错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆