{"id":2696,"date":"2012-03-17T12:32:51","date_gmt":"2012-03-17T12:32:51","guid":{"rendered":"https:\/\/supportex.net\/?p=2696"},"modified":"2019-05-10T17:01:24","modified_gmt":"2019-05-10T15:01:24","slug":"awk-text-between-two-lines","status":"publish","type":"post","link":"https:\/\/supportex.net\/blog\/2012\/03\/awk-text-between-two-lines\/","title":{"rendered":"AWK: how to get text which is between two strings"},"content":{"rendered":"<p>If you need to get some text which is in file between two lines you could use <em>awk<\/em> for this. You may need it while analyzing access logs to fix some issue, for instance. Here&#8217;s how you could do it:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">awk '\/2012:00:20:49\/, \/2012:00:35\/' access_log &gt; output<\/code><\/p>\n<p>It&#8217;s a simple and convenient way.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you need to get some text which is in file between two lines you could use awk for this. You may need it while analyzing access logs to fix some issue, for instance. Here&#8217;s how you could do it: awk &#8216;\/2012:00:20:49\/, \/2012:00:35\/&#8217; access_log &gt; output It&#8217;s a simple and convenient way.<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[152],"tags":[231,275,220],"class_list":["post-2696","post","type-post","status-publish","format-standard","hentry","category-linux","tag-awk-en","tag-linux","tag-tips-en"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>AWK: how to get text which is between two strings &#8211; Supportex.NET blog<\/title>\n<meta name=\"description\" content=\"How to get text which is between two strings in awk. awk text between two strings\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/supportex.net\/blog\/2012\/03\/awk-text-between-two-lines\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"AWK: how to get text which is between two strings &#8211; Supportex.NET blog\" \/>\n<meta property=\"og:description\" content=\"How to get text which is between two strings in awk. awk text between two strings\" \/>\n<meta property=\"og:url\" content=\"https:\/\/supportex.net\/blog\/2012\/03\/awk-text-between-two-lines\/\" \/>\n<meta property=\"og:site_name\" content=\"Supportex.NET blog\" \/>\n<meta property=\"article:published_time\" content=\"2012-03-17T12:32:51+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-05-10T15:01:24+00:00\" \/>\n<meta name=\"author\" content=\"Oleksii Tykhonov\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Oleksii Tykhonov\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/supportex.net\/blog\/2012\/03\/awk-text-between-two-lines\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/supportex.net\/blog\/2012\/03\/awk-text-between-two-lines\/\"},\"author\":{\"name\":\"Oleksii Tykhonov\",\"@id\":\"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251\"},\"headline\":\"AWK: how to get text which is between two strings\",\"datePublished\":\"2012-03-17T12:32:51+00:00\",\"dateModified\":\"2019-05-10T15:01:24+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/supportex.net\/blog\/2012\/03\/awk-text-between-two-lines\/\"},\"wordCount\":58,\"keywords\":[\"awk\",\"linux\",\"tips\"],\"articleSection\":[\"linux\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/supportex.net\/blog\/2012\/03\/awk-text-between-two-lines\/\",\"url\":\"https:\/\/supportex.net\/blog\/2012\/03\/awk-text-between-two-lines\/\",\"name\":\"AWK: how to get text which is between two strings &#8211; Supportex.NET blog\",\"isPartOf\":{\"@id\":\"https:\/\/supportex.net\/blog\/en\/#website\"},\"datePublished\":\"2012-03-17T12:32:51+00:00\",\"dateModified\":\"2019-05-10T15:01:24+00:00\",\"author\":{\"@id\":\"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251\"},\"description\":\"How to get text which is between two strings in awk. awk text between two strings\",\"breadcrumb\":{\"@id\":\"https:\/\/supportex.net\/blog\/2012\/03\/awk-text-between-two-lines\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/supportex.net\/blog\/2012\/03\/awk-text-between-two-lines\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/supportex.net\/blog\/2012\/03\/awk-text-between-two-lines\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/supportex.net\/blog\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"AWK: how to get text which is between two strings\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/supportex.net\/blog\/en\/#website\",\"url\":\"https:\/\/supportex.net\/blog\/en\/\",\"name\":\"Supportex.NET blog\",\"description\":\"Server and network management company\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/supportex.net\/blog\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251\",\"name\":\"Oleksii Tykhonov\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4fd5f58002717075c88963469b9babef?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4fd5f58002717075c88963469b9babef?s=96&d=mm&r=g\",\"caption\":\"Oleksii Tykhonov\"},\"url\":\"https:\/\/supportex.net\/blog\/author\/oleksiitykhonov\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"AWK: how to get text which is between two strings &#8211; Supportex.NET blog","description":"How to get text which is between two strings in awk. awk text between two strings","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:\/\/supportex.net\/blog\/2012\/03\/awk-text-between-two-lines\/","og_locale":"en_US","og_type":"article","og_title":"AWK: how to get text which is between two strings &#8211; Supportex.NET blog","og_description":"How to get text which is between two strings in awk. awk text between two strings","og_url":"https:\/\/supportex.net\/blog\/2012\/03\/awk-text-between-two-lines\/","og_site_name":"Supportex.NET blog","article_published_time":"2012-03-17T12:32:51+00:00","article_modified_time":"2019-05-10T15:01:24+00:00","author":"Oleksii Tykhonov","twitter_misc":{"Written by":"Oleksii Tykhonov"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/supportex.net\/blog\/2012\/03\/awk-text-between-two-lines\/#article","isPartOf":{"@id":"https:\/\/supportex.net\/blog\/2012\/03\/awk-text-between-two-lines\/"},"author":{"name":"Oleksii Tykhonov","@id":"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251"},"headline":"AWK: how to get text which is between two strings","datePublished":"2012-03-17T12:32:51+00:00","dateModified":"2019-05-10T15:01:24+00:00","mainEntityOfPage":{"@id":"https:\/\/supportex.net\/blog\/2012\/03\/awk-text-between-two-lines\/"},"wordCount":58,"keywords":["awk","linux","tips"],"articleSection":["linux"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/supportex.net\/blog\/2012\/03\/awk-text-between-two-lines\/","url":"https:\/\/supportex.net\/blog\/2012\/03\/awk-text-between-two-lines\/","name":"AWK: how to get text which is between two strings &#8211; Supportex.NET blog","isPartOf":{"@id":"https:\/\/supportex.net\/blog\/en\/#website"},"datePublished":"2012-03-17T12:32:51+00:00","dateModified":"2019-05-10T15:01:24+00:00","author":{"@id":"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251"},"description":"How to get text which is between two strings in awk. awk text between two strings","breadcrumb":{"@id":"https:\/\/supportex.net\/blog\/2012\/03\/awk-text-between-two-lines\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/supportex.net\/blog\/2012\/03\/awk-text-between-two-lines\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/supportex.net\/blog\/2012\/03\/awk-text-between-two-lines\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/supportex.net\/blog\/en\/"},{"@type":"ListItem","position":2,"name":"AWK: how to get text which is between two strings"}]},{"@type":"WebSite","@id":"https:\/\/supportex.net\/blog\/en\/#website","url":"https:\/\/supportex.net\/blog\/en\/","name":"Supportex.NET blog","description":"Server and network management company","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/supportex.net\/blog\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251","name":"Oleksii Tykhonov","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/4fd5f58002717075c88963469b9babef?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4fd5f58002717075c88963469b9babef?s=96&d=mm&r=g","caption":"Oleksii Tykhonov"},"url":"https:\/\/supportex.net\/blog\/author\/oleksiitykhonov\/"}]}},"_links":{"self":[{"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/posts\/2696","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/comments?post=2696"}],"version-history":[{"count":4,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/posts\/2696\/revisions"}],"predecessor-version":[{"id":3149,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/posts\/2696\/revisions\/3149"}],"wp:attachment":[{"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/media?parent=2696"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/categories?post=2696"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/tags?post=2696"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}