{"id":2927,"date":"2024-01-16T10:00:24","date_gmt":"2024-01-16T10:00:24","guid":{"rendered":"https:\/\/draculaservers.com\/tutorials\/?p=2927"},"modified":"2024-01-31T21:08:31","modified_gmt":"2024-01-31T21:08:31","slug":"use-grep-to-search-for-multiple-patterns","status":"publish","type":"post","link":"https:\/\/draculaservers.com\/tutorials\/use-grep-to-search-for-multiple-patterns\/","title":{"rendered":"How to Use Grep to Search for Multiple Patterns?"},"content":{"rendered":"<div class=\"cl-preview-section\">\n<p id=\"how-to-use-grep-to-search-for-multiple-patterns\"><span style=\"font-size: 16px;\">Grep, short for Global Regular Expression Print, is a powerful command-line utility in Unix and Unix-like operating systems. It allows users to search for specific patterns or expressions within text files. One of its compelling features is the ability to search for multiple patterns simultaneously, making it a versatile tool for data extraction and analysis. <\/span><\/p>\n<p><span style=\"font-size: 16px;\">In this guide, we\u2019ll explore the various ways you can use Grep to search for multiple patterns.<\/span><\/p>\n\n<\/div>\n<div class=\"cl-preview-section\">\n<h2 id=\"i.-introduction-to-grep\"><span id=\"introduction-to-grep\">Introduction to Grep<\/span><\/h2>\n<\/div>\n<div class=\"cl-preview-section\">\n<p>Before delving into multiple patterns, let\u2019s revisit the basics of Grep. The syntax for a simple Grep command looks like this:<\/p>\n<\/div>\n<div class=\"cl-preview-section\">\n<pre class=\" language-bash\"><code class=\"prism language-bash\"><span class=\"token function\">grep<\/span> pattern filename\r\n<\/code><\/pre>\n<\/div>\n<div class=\"cl-preview-section\">\n<p>Here, \u2018pattern\u2019 is the expression you\u2019re searching for, and \u2018filename\u2019 is the name of the file you want to search within.<\/p>\n<\/div>\n<div class=\"cl-preview-section\">\n<h2 id=\"ii.-searching-for-multiple-patterns\"><span id=\"searching-for-multiple-patterns\">Searching for Multiple Patterns<\/span><\/h2>\n<p>There are multiple different ways through which you can easily search for multiple patterns with the grep command line utility. These different methods are as:<\/p>\n<\/div>\n<div class=\"cl-preview-section\">\n<h3 id=\"a.-using-the-or-operator-\"><span id=\"using-the-or-operator\">Using the OR Operator (|)<\/span><\/h3>\n<\/div>\n<div class=\"cl-preview-section\">\n<p>The OR operator allows you to search for multiple patterns. For instance:<\/p>\n<\/div>\n<div class=\"cl-preview-section\">\n<pre class=\" language-bash\"><code class=\"prism language-bash\"><span class=\"token function\">grep<\/span> <span class=\"token string\">'pattern1\\|pattern2'<\/span> filename\r\n<\/code><\/pre>\n<\/div>\n<div class=\"cl-preview-section\">\n<p>This command searches for lines containing either \u2018pattern1\u2019 or \u2018pattern2\u2019 in the specified file.<\/p>\n<\/div>\n<div class=\"cl-preview-section\">\n<h3 id=\"b.-using-the--e-option\"><span id=\"using-the-e-option\">Using the -e Option<\/span><\/h3>\n<\/div>\n<div class=\"cl-preview-section\">\n<p>The \u2018-e\u2019 option allows you to specify multiple patterns directly:<\/p>\n<\/div>\n<div class=\"cl-preview-section\">\n<pre class=\" language-bash\"><code class=\"prism language-bash\"><span class=\"token function\">grep<\/span> -e pattern1 -e pattern2 filename\r\n<\/code><\/pre>\n<\/div>\n<div class=\"cl-preview-section\">\n<p>This achieves the same result as the OR operator, making it a matter of personal preference.<\/p>\n<h2 id=\"useful-options-for-pattern-matching-through-grep\">Useful Options for Pattern Matching Through Grep<\/h2>\n<p>Apart from normal pattern matching through grep, you can utilize its various option to match different kinds of patterns. Some of these are as follows:<\/p>\n<\/div>\n<div class=\"cl-preview-section\">\n<h3 id=\"iii.-searching-for-whole-words\"><span id=\"searching-for-whole-words-using-the-w-option\">Searching for Whole Words Using the -w Option<\/span><\/h3>\n<p>If you want to search for whole words and not just patterns, then you can use the&#8221;-w&#8221; option. The \u2018-w\u2019 option ensures that Grep matches only whole words, avoiding partial matches:<\/p>\n<\/div>\n<div class=\"cl-preview-section\">\n<pre class=\" language-bash\"><code class=\"prism language-bash\"><span class=\"token function\">grep<\/span> -w <span class=\"token string\">'pattern'<\/span> filename\r\n<\/code><\/pre>\n<\/div>\n<div class=\"cl-preview-section\">\n<h3 id=\"iv.-inverting-matches\"><span id=\"inverting-matches-using-the-v-option\">Inverting Matches Using the -v Option<\/span><\/h3>\n<p>You can also have the grep utility to go for inverting matches. The \u2018-v\u2019 option inverts matches, showing lines that do not contain the specified patterns:<\/p>\n<\/div>\n<div class=\"cl-preview-section\">\n<pre class=\" language-bash\"><code class=\"prism language-bash\"><span class=\"token function\">grep<\/span> -v <span class=\"token string\">'pattern'<\/span> filename\r\n<\/code><\/pre>\n<\/div>\n<div class=\"cl-preview-section\">\n<h3 id=\"v.-recursive-searching-in-directories\"><span id=\"recursive-searching-in-directories-using-the-r-option\">Recursive Searching in Directories using the -r Option<\/span><\/h3>\n<\/div>\n<div class=\"cl-preview-section\">\n<p>To search for patterns in all files within a directory and its subdirectories:<\/p>\n<\/div>\n<div class=\"cl-preview-section\">\n<pre class=\" language-bash\"><code class=\"prism language-bash\"><span class=\"token function\">grep<\/span> -r <span class=\"token string\">'pattern'<\/span> directory\r\n<\/code><\/pre>\n<\/div>\n<div class=\"cl-preview-section\">\n<h2 id=\"vi.-real-world-examples\"><span id=\"examples-for-searching-multiple-patterns-through-grep\">Examples for Searching Multiple Patterns Through Grep<\/span><\/h2>\n<p>There are a lot of scenarios where the system admin is required to search for multiple patterns at the same time. Let&#8217;s take a look a couple of such patterns.<\/p>\n<\/div>\n<div class=\"cl-preview-section\">\n<h3 id=\"a.-scenario-1-searching-for-errors\"><span id=\"scenario-1-searching-for-errors\">Scenario 1: Searching for Errors<\/span><\/h3>\n<\/div>\n<div class=\"cl-preview-section\">\n<p>In log files, searching for multiple error patterns simultaneously:<\/p>\n<\/div>\n<div class=\"cl-preview-section\">\n<pre class=\" language-bash\"><code class=\"prism language-bash\"><span class=\"token function\">grep<\/span> -e <span class=\"token string\">'error'<\/span> -e <span class=\"token string\">'fatal'<\/span> logfile.txt\r\n<\/code><\/pre>\n<\/div>\n<div class=\"cl-preview-section\">\n<h3 id=\"b.-scenario-2-extracting-relevant-information\"><span id=\"scenario-2-extracting-relevant-information\">Scenario 2: Extracting Relevant Information<\/span><\/h3>\n<\/div>\n<div class=\"cl-preview-section\">\n<p>For a CSV file, extracting lines with \u2018user\u2019 or \u2018admin\u2019:<\/p>\n<\/div>\n<div class=\"cl-preview-section\">\n<pre class=\" language-bash\"><code class=\"prism language-bash\"><span class=\"token function\">grep<\/span> -e <span class=\"token string\">'user'<\/span> -e <span class=\"token string\">'admin'<\/span> data.csv\r\n<\/code><\/pre>\n<\/div>\n<div class=\"cl-preview-section\">\n<h2 id=\"explore-dracula-servers-your-gateway-to-reliable-vps-hosting\">Explore Dracula Servers: Your Gateway to Reliable VPS Hosting<\/h2>\n<p>Looking for a powerful and dependable VPS hosting solution? Look no further than <a href=\"https:\/\/draculaservers.com\/freeradius-vps\" target=\"_new\" rel=\"noopener\">Dracula Servers<\/a>. Specializing in high-performance VPS services, Dracula Servers offers an exceptional environment for hosting applications, websites, and more.<\/p>\n<h3 id=\"why-choose-dracula-servers\">Why Choose Dracula Servers?<\/h3>\n<ol>\n<li><strong>Performance:<\/strong> Benefit from top-notch server performance and stability, ensuring your applications run seamlessly.<\/li>\n<li><strong>Flexibility:<\/strong> Dracula Servers provides a range of VPS configurations, allowing you to tailor your server environment to meet your specific needs.<\/li>\n<li><strong>Security:<\/strong> With a commitment to robust security measures, Dracula Servers ensures the safety of your data and applications.<\/li>\n<li><strong>24\/7 Support:<\/strong> Have peace of mind with round-the-clock customer support, ready to assist you with any inquiries or issues.<\/li>\n<\/ol>\n<h3 id=\"discover-the-freeradius-vps-package\">Discover the FreeRadius VPS Package<\/h3>\n<p>Explore the specialized <a href=\"https:\/\/draculaservers.com\/freeradius-vps\" target=\"_new\" rel=\"noopener\">FreeRadius VPS package<\/a>, crafted for users seeking a reliable hosting environment for FreeRadius applications. This package combines the power of Dracula Servers with the specific needs of FreeRadius, providing a hosting solution that empowers your projects.<\/p>\n<p>Ready to elevate your hosting experience? <a href=\"https:\/\/draculaservers.com\/freeradius-vps\" target=\"_new\" rel=\"noopener\">Explore Dracula Servers now<\/a> and unlock a world of performance, flexibility, and top-notch support for your VPS hosting needs.<\/p>\n<h2 id=\"vii.-best-practices-and-tips\"><span id=\"best-practices-and-tips\">Best Practices and Tips<\/span><\/h2>\n<\/div>\n<div class=\"cl-preview-section\">\n<h3 id=\"a.-use-regular-expressions\"><span id=\"a-use-regular-expressions\">A. Use Regular Expressions<\/span><\/h3>\n<\/div>\n<div class=\"cl-preview-section\">\n<p>Grep supports powerful regular expressions. Utilize them for more complex pattern matching.<\/p>\n<\/div>\n<div class=\"cl-preview-section\">\n<h3 id=\"b.-combine-grep-with-other-commands\"><span id=\"b-combine-grep-with-other-commands\">B. Combine Grep with Other Commands<\/span><\/h3>\n<\/div>\n<div class=\"cl-preview-section\">\n<p>Enhance Grep\u2019s functionality by combining it with other commands in the Unix toolkit.<\/p>\n<\/div>\n<div class=\"cl-preview-section\">\n<h3 id=\"c.-utilize-grep-recursively\"><span id=\"c-utilize-grep-recursively\">C. Utilize Grep Recursively<\/span><\/h3>\n<\/div>\n<div class=\"cl-preview-section\">\n<p>When dealing with directories, the \u2018-r\u2019 option can save time and provide comprehensive results.<\/p>\n<\/div>\n<div class=\"cl-preview-section\">\n<h2 id=\"viii.-conclusion\"><span id=\"conclusion\">Conclusion<\/span><\/h2>\n<\/div>\n<div class=\"cl-preview-section\">\n<p>Mastering Grep\u2019s ability to search for multiple patterns opens up a realm of possibilities for efficient data exploration. Whether you\u2019re analyzing logs, extracting specific information from files, or troubleshooting code, Grep remains an indispensable tool. By incorporating the techniques discussed here into your workflow, you empower yourself to navigate and extract valuable insights from textual data.<\/p>\n<p>Check out More Linux Tutorials <a href=\"https:\/\/draculaservers.com\/tutorials\/\" target=\"_blank\" rel=\"noopener\">Here!<\/a><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Grep, short for Global Regular Expression Print, is a powerful command-line utility in Unix and Unix-like operating systems. It allows users to search for specific patterns or expressions within text files. One of its compelling features is the ability to search for multiple patterns simultaneously, making it a versatile tool for data extraction and analysis. [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":2928,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,172],"tags":[246,248,247],"class_list":["post-2927","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux-basics","category-linux-tutorials","tag-grep-for-multiple-patterns","tag-grep-in-linux","tag-how-to-use-grep-in-linux"],"blocksy_meta":[],"featured_image_urls_v2":{"full":["https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2024\/01\/What-27.png",1280,720,false],"thumbnail":["https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2024\/01\/What-27-150x150.png",150,150,true],"medium":["https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2024\/01\/What-27-300x169.png",300,169,true],"medium_large":["https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2024\/01\/What-27-768x432.png",768,432,true],"large":["https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2024\/01\/What-27-1024x576.png",1024,576,true],"1536x1536":["https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2024\/01\/What-27.png",1280,720,false],"2048x2048":["https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2024\/01\/What-27.png",1280,720,false],"pk-small":["https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2024\/01\/What-27-80x80.png",80,80,true],"pk-thumbnail":["https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2024\/01\/What-27-300x225.png",300,225,true]},"post_excerpt_stackable_v2":"<p>Grep, short for Global Regular Expression Print, is a powerful command-line utility in Unix and Unix-like operating systems. It allows users to search for specific patterns or expressions within text files. One of its compelling features is the ability to search for multiple patterns simultaneously, making it a versatile tool for data extraction and analysis. In this guide, we\u2019ll explore the various ways you can use Grep to search for multiple patterns. Introduction to Grep Before delving into multiple patterns, let\u2019s revisit the basics of Grep. The syntax for a simple Grep command looks like this: grep pattern filename Here,&hellip;<\/p>\n","category_list_v2":"<a href=\"https:\/\/draculaservers.com\/tutorials\/category\/linux-basics\/\" rel=\"category tag\">Linux Basics<\/a>, <a href=\"https:\/\/draculaservers.com\/tutorials\/category\/linux-tutorials\/\" rel=\"category tag\">Linux Tutorials<\/a>","author_info_v2":{"name":"Abdul Mannan","url":"https:\/\/draculaservers.com\/tutorials\/author\/abdul-mannan-tbgmail-com\/"},"comments_num_v2":"0 comments","yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Use Grep to Search for Multiple Patterns? - Dracula Servers Tutorials<\/title>\n<meta name=\"description\" content=\"To Use Grep to Search for Multiple Patterns, you can use the OR operator between the patterns or use the &quot;-e&quot; option\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/draculaservers.com\/tutorials\/use-grep-to-search-for-multiple-patterns\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Use Grep to Search for Multiple Patterns? - Dracula Servers Tutorials\" \/>\n<meta property=\"og:description\" content=\"To Use Grep to Search for Multiple Patterns, you can use the OR operator between the patterns or use the &quot;-e&quot; option\" \/>\n<meta property=\"og:url\" content=\"https:\/\/draculaservers.com\/tutorials\/use-grep-to-search-for-multiple-patterns\/\" \/>\n<meta property=\"og:site_name\" content=\"Dracula Servers Tutorials\" \/>\n<meta property=\"article:published_time\" content=\"2024-01-16T10:00:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-31T21:08:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2024\/01\/What-27.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"720\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Abdul Mannan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Abdul Mannan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/use-grep-to-search-for-multiple-patterns\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/use-grep-to-search-for-multiple-patterns\\\/\"},\"author\":{\"name\":\"Abdul Mannan\",\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/ac89d0281f4fb596bfaa0bc1e746c8a6\"},\"headline\":\"How to Use Grep to Search for Multiple Patterns?\",\"datePublished\":\"2024-01-16T10:00:24+00:00\",\"dateModified\":\"2024-01-31T21:08:31+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/use-grep-to-search-for-multiple-patterns\\\/\"},\"wordCount\":723,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/use-grep-to-search-for-multiple-patterns\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2024\\\/01\\\/What-27.png\",\"keywords\":[\"Grep for Multiple Patterns\",\"Grep in Linux\",\"How to use grep in Linux\"],\"articleSection\":[\"Linux Basics\",\"Linux Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/use-grep-to-search-for-multiple-patterns\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/use-grep-to-search-for-multiple-patterns\\\/\",\"url\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/use-grep-to-search-for-multiple-patterns\\\/\",\"name\":\"How to Use Grep to Search for Multiple Patterns? - Dracula Servers Tutorials\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/use-grep-to-search-for-multiple-patterns\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/use-grep-to-search-for-multiple-patterns\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2024\\\/01\\\/What-27.png\",\"datePublished\":\"2024-01-16T10:00:24+00:00\",\"dateModified\":\"2024-01-31T21:08:31+00:00\",\"description\":\"To Use Grep to Search for Multiple Patterns, you can use the OR operator between the patterns or use the \\\"-e\\\" option\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/use-grep-to-search-for-multiple-patterns\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/use-grep-to-search-for-multiple-patterns\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/use-grep-to-search-for-multiple-patterns\\\/#primaryimage\",\"url\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2024\\\/01\\\/What-27.png\",\"contentUrl\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2024\\\/01\\\/What-27.png\",\"width\":1280,\"height\":720,\"caption\":\"How to Use Grep to Search for Multiple Patterns?\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/use-grep-to-search-for-multiple-patterns\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Use Grep to Search for Multiple Patterns?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/#website\",\"url\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/\",\"name\":\"Dracula Servers Tutorials\",\"description\":\"Dedicated Servers\",\"publisher\":{\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/#organization\",\"name\":\"Dracula Servers\",\"url\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2016\\\/06\\\/dracula_full_logo_smaller.png\",\"contentUrl\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2016\\\/06\\\/dracula_full_logo_smaller.png\",\"width\":1625,\"height\":200,\"caption\":\"Dracula Servers\"},\"image\":{\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/ac89d0281f4fb596bfaa0bc1e746c8a6\",\"name\":\"Abdul Mannan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2809442d44177cab4f90e1d9b3295560462063881ca1374b6d597d8f0b48fc21?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2809442d44177cab4f90e1d9b3295560462063881ca1374b6d597d8f0b48fc21?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2809442d44177cab4f90e1d9b3295560462063881ca1374b6d597d8f0b48fc21?s=96&d=mm&r=g\",\"caption\":\"Abdul Mannan\"},\"description\":\"An individual trying to decipher the enigmas of technology by the sheer driving force of curiosity. Interested in learning new skills and being better at those skills than the lot.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Use Grep to Search for Multiple Patterns? - Dracula Servers Tutorials","description":"To Use Grep to Search for Multiple Patterns, you can use the OR operator between the patterns or use the \"-e\" option","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/draculaservers.com\/tutorials\/use-grep-to-search-for-multiple-patterns\/","og_locale":"en_US","og_type":"article","og_title":"How to Use Grep to Search for Multiple Patterns? - Dracula Servers Tutorials","og_description":"To Use Grep to Search for Multiple Patterns, you can use the OR operator between the patterns or use the \"-e\" option","og_url":"https:\/\/draculaservers.com\/tutorials\/use-grep-to-search-for-multiple-patterns\/","og_site_name":"Dracula Servers Tutorials","article_published_time":"2024-01-16T10:00:24+00:00","article_modified_time":"2024-01-31T21:08:31+00:00","og_image":[{"width":1280,"height":720,"url":"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2024\/01\/What-27.png","type":"image\/png"}],"author":"Abdul Mannan","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Abdul Mannan","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/draculaservers.com\/tutorials\/use-grep-to-search-for-multiple-patterns\/#article","isPartOf":{"@id":"https:\/\/draculaservers.com\/tutorials\/use-grep-to-search-for-multiple-patterns\/"},"author":{"name":"Abdul Mannan","@id":"https:\/\/draculaservers.com\/tutorials\/#\/schema\/person\/ac89d0281f4fb596bfaa0bc1e746c8a6"},"headline":"How to Use Grep to Search for Multiple Patterns?","datePublished":"2024-01-16T10:00:24+00:00","dateModified":"2024-01-31T21:08:31+00:00","mainEntityOfPage":{"@id":"https:\/\/draculaservers.com\/tutorials\/use-grep-to-search-for-multiple-patterns\/"},"wordCount":723,"commentCount":0,"publisher":{"@id":"https:\/\/draculaservers.com\/tutorials\/#organization"},"image":{"@id":"https:\/\/draculaservers.com\/tutorials\/use-grep-to-search-for-multiple-patterns\/#primaryimage"},"thumbnailUrl":"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2024\/01\/What-27.png","keywords":["Grep for Multiple Patterns","Grep in Linux","How to use grep in Linux"],"articleSection":["Linux Basics","Linux Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/draculaservers.com\/tutorials\/use-grep-to-search-for-multiple-patterns\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/draculaservers.com\/tutorials\/use-grep-to-search-for-multiple-patterns\/","url":"https:\/\/draculaservers.com\/tutorials\/use-grep-to-search-for-multiple-patterns\/","name":"How to Use Grep to Search for Multiple Patterns? - Dracula Servers Tutorials","isPartOf":{"@id":"https:\/\/draculaservers.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/draculaservers.com\/tutorials\/use-grep-to-search-for-multiple-patterns\/#primaryimage"},"image":{"@id":"https:\/\/draculaservers.com\/tutorials\/use-grep-to-search-for-multiple-patterns\/#primaryimage"},"thumbnailUrl":"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2024\/01\/What-27.png","datePublished":"2024-01-16T10:00:24+00:00","dateModified":"2024-01-31T21:08:31+00:00","description":"To Use Grep to Search for Multiple Patterns, you can use the OR operator between the patterns or use the \"-e\" option","breadcrumb":{"@id":"https:\/\/draculaservers.com\/tutorials\/use-grep-to-search-for-multiple-patterns\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/draculaservers.com\/tutorials\/use-grep-to-search-for-multiple-patterns\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/draculaservers.com\/tutorials\/use-grep-to-search-for-multiple-patterns\/#primaryimage","url":"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2024\/01\/What-27.png","contentUrl":"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2024\/01\/What-27.png","width":1280,"height":720,"caption":"How to Use Grep to Search for Multiple Patterns?"},{"@type":"BreadcrumbList","@id":"https:\/\/draculaservers.com\/tutorials\/use-grep-to-search-for-multiple-patterns\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/draculaservers.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"How to Use Grep to Search for Multiple Patterns?"}]},{"@type":"WebSite","@id":"https:\/\/draculaservers.com\/tutorials\/#website","url":"https:\/\/draculaservers.com\/tutorials\/","name":"Dracula Servers Tutorials","description":"Dedicated Servers","publisher":{"@id":"https:\/\/draculaservers.com\/tutorials\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/draculaservers.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/draculaservers.com\/tutorials\/#organization","name":"Dracula Servers","url":"https:\/\/draculaservers.com\/tutorials\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/draculaservers.com\/tutorials\/#\/schema\/logo\/image\/","url":"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2016\/06\/dracula_full_logo_smaller.png","contentUrl":"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2016\/06\/dracula_full_logo_smaller.png","width":1625,"height":200,"caption":"Dracula Servers"},"image":{"@id":"https:\/\/draculaservers.com\/tutorials\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/draculaservers.com\/tutorials\/#\/schema\/person\/ac89d0281f4fb596bfaa0bc1e746c8a6","name":"Abdul Mannan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/2809442d44177cab4f90e1d9b3295560462063881ca1374b6d597d8f0b48fc21?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/2809442d44177cab4f90e1d9b3295560462063881ca1374b6d597d8f0b48fc21?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2809442d44177cab4f90e1d9b3295560462063881ca1374b6d597d8f0b48fc21?s=96&d=mm&r=g","caption":"Abdul Mannan"},"description":"An individual trying to decipher the enigmas of technology by the sheer driving force of curiosity. Interested in learning new skills and being better at those skills than the lot."}]}},"_links":{"self":[{"href":"https:\/\/draculaservers.com\/tutorials\/wp-json\/wp\/v2\/posts\/2927","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/draculaservers.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/draculaservers.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/draculaservers.com\/tutorials\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/draculaservers.com\/tutorials\/wp-json\/wp\/v2\/comments?post=2927"}],"version-history":[{"count":2,"href":"https:\/\/draculaservers.com\/tutorials\/wp-json\/wp\/v2\/posts\/2927\/revisions"}],"predecessor-version":[{"id":2930,"href":"https:\/\/draculaservers.com\/tutorials\/wp-json\/wp\/v2\/posts\/2927\/revisions\/2930"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/draculaservers.com\/tutorials\/wp-json\/wp\/v2\/media\/2928"}],"wp:attachment":[{"href":"https:\/\/draculaservers.com\/tutorials\/wp-json\/wp\/v2\/media?parent=2927"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/draculaservers.com\/tutorials\/wp-json\/wp\/v2\/categories?post=2927"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/draculaservers.com\/tutorials\/wp-json\/wp\/v2\/tags?post=2927"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}