Regular expressions are a powerful way to search for patterns in text because they allow you to specify complex search criteria. Grep uses regular expressions to search for patterns in text files. Grep is a part of the GNU core utilities, which are a set of essential tools for Linux and Unix-based systems. Grep stands for "Global Regular Expression Print." It's a command-line tool that searches for patterns in text files and outputs the matching lines. In this article, we'll explore how to use grep to search for multiple strings at once. It's a versatile tool that can be used for a wide range of tasks, including finding and replacing text, searching for specific lines of code, and filtering data. Save my name, email, and website in this browser for the next time I comment.Grep is a powerful command-line tool used for searching text files for specific patterns or strings. 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. $ grep ‘INFO.*DEBUG\|DEBUG.*INFO’ applicationLog.log.Command to find “INFO” and “DEBUG” in applicationLog.log file. $ egrep ‘DEBUG|ERROR’ applicationLog.log.$ grep ‘DEBUG\|ERROR’ applicationLog.log.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |