![]() ![]() This command searches for lines in the file.txt file that contain either word1 or word2 followed by word3.īy using regular expressions or special characters such as | and (), you can search for multiple words or a string pattern using the grep command on Bash. It's always a good idea to carefully review the documentation and use the appropriate syntax when working with regular expressions. grep -i With multiple strings, after using grep on another command. ![]() (the file handling bit) (c) 2005, Joel Schopp (the ugly bit) (c) 2007,2008, Andy Whitcroft (new conditions, test suite. This will help ensure that your search is accurate and efficient. Save my name, email, and website in this browser for the next time I comment.For example: last grep -i abc last grep -i uyx I wish the combine the above into one command, but when searching on the internet I can only find references on how to use multiple strings with grep, when grep is used with a file, and not a command. Your email address will not be published. Command to find “ERROR” or “DEBUG” in applicationLog.log file 14:20:13.966 INFO-DEBUG 1051 - o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path onto handler of type ġ. 14:20:13.921 INFO 1051 - s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped “” onto public .ModelAndView .(, 14:20:13.807 DEBUG 1051 - s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for startup date root of context hierarchy 14:20:13.441 INFO 1051 - o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: ‘requestContextFilter’ to: 14:20:13.436 WARNING 1051 - o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: ‘dispatcherServlet’ to 14:20:13.240 INFO 1051 - o.s. : Root WebApplicationContext: initialization completed in 2629 ms : Initializing Spring embedded WebApplicationContext Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. 14:20:13.227 INFO 1051 - .TldScanner : At least one JAR was scanned for TLDs yet contained no TLDs. 14:20:12.725 INFO 1051 - .StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.14 14:20:12.697 ERROR 1051 - s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http) :: Spring Boot :: (v1.5.3.RELEASE) 14:20:10.519 INFO 1051 - o.a.j.SpringBootHelloWorldApplication : Starting SpringBootHelloWorldApplication on apples-MacBook-Air.local with PID 1051 (/Users/apple/Documents/WorkspaceAlgo/SpringBootHelloWorldExample/target/classes started by apple in /Users/apple/Documents/WorkspaceAlgo/SpringBootHelloWorldExample) Let’s say your application is deployed on linux machine and you need do analysis of log file and you need to find lines with the specific words in it.įor example: you want to find all the lines with “ WARNING” or “ DEBUG” words in it. In this post, we will see how to grep multiple Strings in linux. 5.Command to find “ERROR” or “DEBUG” in all logs files in the current folder in applicationLog.log file.$ grep -i ‘DEBUG\|ERROR’ applicationLog.log.4.Command to find “ERROR” or “DEBUG” witn case insensitive in applicationLog.log file in applicationLog.log file.$ grep -n ‘INFO.*DEBUG\|DEBUG.*INFO’ applicationLog.log.Command to find “INFO” and “DEBUG” with line number in applicationLog.log file. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |