1.2GB 文本文件出现 Grep 错误或达到限制?

1.2GB 文本文件出现 Grep 错误或达到限制?

在大型文件上使用 grep 后跟 tail 会产生错误结果,见下文证明。该文件有 1.2GB 大,但 grep 应该将其作为流处理,那么问题可能出在哪里?

root@condor1796 /home/glassfish/apache-tomcat-8.5.5/logs # tail -n 20000 catalina.out | grep "Deploy"
10-Jan-2017 02:26:48.011 INFO [www.numbeo.com-startStop-2] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive /home/glassfish/apache-tomcat-8.5.5/appBaseLivingCost/ROOT.war
10-Jan-2017 02:26:49.850 INFO [www.numbeo.com-startStop-2] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /home/glassfish/apache-tomcat-8.5.5/appBaseLivingCost/ROOT.war has finished in 1,839 ms
10-Jan-2017 02:28:56.096 INFO [www.numbeo.com-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive /home/glassfish/apache-tomcat-8.5.5/appBaseLivingCost/ROOT.war
10-Jan-2017 02:28:56.718 INFO [www.numbeo.com-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /home/glassfish/apache-tomcat-8.5.5/appBaseLivingCost/ROOT.war has finished in 622 ms
10-Jan-2017 02:28:56.719 INFO [numbeo.com-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive /home/glassfish/apache-tomcat-8.5.5/appBaseNonWwwNumbeo/ROOT.war
10-Jan-2017 02:28:56.823 INFO [numbeo.com-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /home/glassfish/apache-tomcat-8.5.5/appBaseNonWwwNumbeo/ROOT.war has finished in 104 ms
10-Jan-2017 02:28:56.868 INFO [intl.numbeo.com-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive /home/glassfish/apache-tomcat-8.5.5/appBaseAcmeOnly/ROOT.war
10-Jan-2017 02:28:56.909 INFO [intl.numbeo.com-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /home/glassfish/apache-tomcat-8.5.5/appBaseAcmeOnly/ROOT.war has finished in 41 ms
10-Jan-2017 02:28:56.910 INFO [numbeo.com-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive /home/glassfish/apache-tomcat-8.5.5/appBaseNonWwwNumbeo/ROOT.war
10-Jan-2017 02:28:56.979 INFO [numbeo.com-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /home/glassfish/apache-tomcat-8.5.5/appBaseNonWwwNumbeo/ROOT.war has finished in 68 ms


root@condor1796 /home/glassfish/apache-tomcat-8.5.5/logs # grep "Deploy" ~glassfish/apache-tomcat-8.5.5/logs/catalina.out | tail -n 6
21-Dec-2016 04:40:24.964 INFO [numbeo.com-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /home/glassfish/apache-tomcat-8.5.5/appBaseNonWwwNumbeo/ROOT.war has finished in 110 ms
21-Dec-2016 04:40:25.001 INFO [intl.numbeo.com-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive /home/glassfish/apache-tomcat-8.5.5/appBaseAcmeOnly/ROOT.war
21-Dec-2016 04:40:25.096 INFO [intl.numbeo.com-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /home/glassfish/apache-tomcat-8.5.5/appBaseAcmeOnly/ROOT.war has finished in 95 ms
21-Dec-2016 04:40:25.098 INFO [numbeo.com-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive /home/glassfish/apache-tomcat-8.5.5/appBaseNonWwwNumbeo/ROOT.war
21-Dec-2016 04:40:25.210 INFO [numbeo.com-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /home/glassfish/apache-tomcat-8.5.5/appBaseNonWwwNumbeo/ROOT.war has finished in 112 ms
Binary file /home/glassfish/apache-tomcat-8.5.5/logs/catalina.out matches
root@condor1796 /home/glassfish/apache-tomcat-8.5.5/logs # 

相关内容