{"id":288,"date":"2022-01-11T13:40:11","date_gmt":"2022-01-11T13:40:11","guid":{"rendered":"https:\/\/www.jibsheet.net\/linux\/?p=288"},"modified":"2022-01-11T13:40:11","modified_gmt":"2022-01-11T13:40:11","slug":"bash-using-mailx-command-to-parse-subjects","status":"publish","type":"post","link":"https:\/\/www.jibsheet.net\/linux\/index.php\/2022\/01\/11\/bash-using-mailx-command-to-parse-subjects\/","title":{"rendered":"Bash &#8211; using mailx command to parse subjects"},"content":{"rendered":"<p>Problem:\u00a0 It appears that the default mail -H appears to truncate the subject.\u00a0 Grep fails to find text pass the email address.<\/p>\n<p>Fix:\u00a0 Use Headline to format<\/p>\n<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">echo 'f 1-$' | mail -H -S headline=\"%&gt;%a%m %20f  %16d %3l\/%-5o %i%150S\" | grep -i ANZ535 | wc -l\r\n<\/pre>\n<p>Here is what the issue looks like<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">[ec2-user@jibsheet data]$ echo 'f 1-$' | mail  &gt; \/tmp\/out.txt\r\n[ec2-user@jibsheet data]$ tail \/tmp\/out.txt\r\n U3010 Cron Daemon           Sun Jan  9 03:00 1515\/90167 \"Cron &lt;ec2-user@jibs\"\r\n  3011 Cron Daemon           Mon Jan 10 01:33 241\/7296  \"Cron &lt;ec2-user@jibsh\"\r\n U3012 Cron Daemon           Mon Jan 10 02:00  50\/2319  \"Cron &lt;ec2-user@jibsh\"\r\n U3013 Cron Daemon           Mon Jan 10 02:00  50\/2289  \"Cron &lt;ec2-user@jibsh\"\r\n U3014 Cron Daemon           Mon Jan 10 03:00 1522\/90593 \"Cron &lt;ec2-user@jibs\"\r\n U3015 Cron Daemon           Tue Jan 11 01:33 241\/7295  \"Cron &lt;ec2-user@jibsh\"\r\n U3016 Cron Daemon           Tue Jan 11 02:00  50\/2319  \"Cron &lt;ec2-user@jibsh\"\r\n U3017 Cron Daemon           Tue Jan 11 02:00  50\/2289  \"Cron &lt;ec2-user@jibsh\"\r\n U3018 Cron Daemon           Tue Jan 11 03:00 1529\/91012 \"Cron &lt;ec2-user@jibs\"\r\n<\/pre>\n<p>fix looks like<\/p>\n<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">U3015 Cron Daemon           Tue Jan 11 01:33 241\/7295  \"Cron &lt;myuser@jibsheet&gt; \/home\/myuser\/python\/test4\/weather_obs\/noaa_tide_chart_puller.py\"\r\n U3016 Cron Daemon           Tue Jan 11 02:00  50\/2319  \"Cron &lt;myuser@jibsheet&gt; \/home\/myuser\/github\/aws-scripts\/aws_s3_backup_retention.py --days 10 --min 10 --bucket mybucket --backup_prefix ANZ535\"\r\n U3017 Cron Daemon           Tue Jan 11 02:00  50\/2289  \"Cron &lt;myuser@jibsheet&gt; \/home\/myuser\/github\/aws-scripts\/aws_s3_backup_retention.py --days 10 --bucket mybucket --backup_prefix KDCA.tgz\"\r\n U3018 Cron Daemon           Tue Jan 11 03:00 1529\/91012 \"Cron &lt;myuser@jibsheet&gt; \/var\/www\/html\/weather_obs\/noaa_back.sh 'ANZ535*.txt' '\/var\/www\/html'  mybucket ANZ535.tgz\"<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Problem:\u00a0 It appears that the default mail -H appears to truncate the subject.\u00a0 Grep fails to find text pass the email address. Fix:\u00a0 Use Headline to format &nbsp; echo &#8216;f 1-$&#8217; | mail -H -S headline=&#8221;%&gt;%a%m %20f %16d %3l\/%-5o %i%150S&#8221; | grep -i ANZ535 | wc -l Here is what the issue looks like [ec2-user@jibsheet data]$ echo &#8216;f 1-$&#8217; | [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[22,5],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Bash - using mailx command to parse subjects - Jon Allen&#039;s Linux Stuff<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.jibsheet.net\/linux\/index.php\/2022\/01\/11\/bash-using-mailx-command-to-parse-subjects\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Bash - using mailx command to parse subjects - Jon Allen&#039;s Linux Stuff\" \/>\n<meta property=\"og:description\" content=\"Problem:\u00a0 It appears that the default mail -H appears to truncate the subject.\u00a0 Grep fails to find text pass the email address. Fix:\u00a0 Use Headline to format &nbsp; echo &#039;f 1-$&#039; | mail -H -S headline=&quot;%&gt;%a%m %20f %16d %3l\/%-5o %i%150S&quot; | grep -i ANZ535 | wc -l Here is what the issue looks like [ec2-user@jibsheet data]$ echo &#039;f 1-$&#039; | [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.jibsheet.net\/linux\/index.php\/2022\/01\/11\/bash-using-mailx-command-to-parse-subjects\/\" \/>\n<meta property=\"og:site_name\" content=\"Jon Allen&#039;s Linux Stuff\" \/>\n<meta property=\"article:published_time\" content=\"2022-01-11T13:40:11+00:00\" \/>\n<meta name=\"author\" content=\"jonallen\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"jonallen\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2022\/01\/11\/bash-using-mailx-command-to-parse-subjects\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2022\/01\/11\/bash-using-mailx-command-to-parse-subjects\/\"},\"author\":{\"name\":\"jonallen\",\"@id\":\"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/295a80d0b2aa929b648c4fdddee83993\"},\"headline\":\"Bash &#8211; using mailx command to parse subjects\",\"datePublished\":\"2022-01-11T13:40:11+00:00\",\"dateModified\":\"2022-01-11T13:40:11+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2022\/01\/11\/bash-using-mailx-command-to-parse-subjects\/\"},\"wordCount\":48,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/295a80d0b2aa929b648c4fdddee83993\"},\"articleSection\":[\"bash\",\"Linux\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.jibsheet.net\/linux\/index.php\/2022\/01\/11\/bash-using-mailx-command-to-parse-subjects\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2022\/01\/11\/bash-using-mailx-command-to-parse-subjects\/\",\"url\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2022\/01\/11\/bash-using-mailx-command-to-parse-subjects\/\",\"name\":\"Bash - using mailx command to parse subjects - Jon Allen&#039;s Linux Stuff\",\"isPartOf\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/#website\"},\"datePublished\":\"2022-01-11T13:40:11+00:00\",\"dateModified\":\"2022-01-11T13:40:11+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2022\/01\/11\/bash-using-mailx-command-to-parse-subjects\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.jibsheet.net\/linux\/index.php\/2022\/01\/11\/bash-using-mailx-command-to-parse-subjects\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2022\/01\/11\/bash-using-mailx-command-to-parse-subjects\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.jibsheet.net\/linux\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Bash &#8211; using mailx command to parse subjects\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.jibsheet.net\/linux\/#website\",\"url\":\"https:\/\/www.jibsheet.net\/linux\/\",\"name\":\"Jon Allen's Linux Stuff\",\"description\":\"Howto&#039;s, Observations, and stuff\",\"publisher\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/295a80d0b2aa929b648c4fdddee83993\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.jibsheet.net\/linux\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/295a80d0b2aa929b648c4fdddee83993\",\"name\":\"jonallen\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/7d7c061ce9db8f5e4710555585475882?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/7d7c061ce9db8f5e4710555585475882?s=96&d=mm&r=g\",\"caption\":\"jonallen\"},\"logo\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/www.jibsheet.net\/linux\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Bash - using mailx command to parse subjects - Jon Allen&#039;s Linux Stuff","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:\/\/www.jibsheet.net\/linux\/index.php\/2022\/01\/11\/bash-using-mailx-command-to-parse-subjects\/","og_locale":"en_US","og_type":"article","og_title":"Bash - using mailx command to parse subjects - Jon Allen&#039;s Linux Stuff","og_description":"Problem:\u00a0 It appears that the default mail -H appears to truncate the subject.\u00a0 Grep fails to find text pass the email address. Fix:\u00a0 Use Headline to format &nbsp; echo 'f 1-$' | mail -H -S headline=\"%&gt;%a%m %20f %16d %3l\/%-5o %i%150S\" | grep -i ANZ535 | wc -l Here is what the issue looks like [ec2-user@jibsheet data]$ echo 'f 1-$' | [&hellip;]","og_url":"https:\/\/www.jibsheet.net\/linux\/index.php\/2022\/01\/11\/bash-using-mailx-command-to-parse-subjects\/","og_site_name":"Jon Allen&#039;s Linux Stuff","article_published_time":"2022-01-11T13:40:11+00:00","author":"jonallen","twitter_card":"summary_large_image","twitter_misc":{"Written by":"jonallen","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2022\/01\/11\/bash-using-mailx-command-to-parse-subjects\/#article","isPartOf":{"@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2022\/01\/11\/bash-using-mailx-command-to-parse-subjects\/"},"author":{"name":"jonallen","@id":"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/295a80d0b2aa929b648c4fdddee83993"},"headline":"Bash &#8211; using mailx command to parse subjects","datePublished":"2022-01-11T13:40:11+00:00","dateModified":"2022-01-11T13:40:11+00:00","mainEntityOfPage":{"@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2022\/01\/11\/bash-using-mailx-command-to-parse-subjects\/"},"wordCount":48,"commentCount":0,"publisher":{"@id":"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/295a80d0b2aa929b648c4fdddee83993"},"articleSection":["bash","Linux"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.jibsheet.net\/linux\/index.php\/2022\/01\/11\/bash-using-mailx-command-to-parse-subjects\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2022\/01\/11\/bash-using-mailx-command-to-parse-subjects\/","url":"https:\/\/www.jibsheet.net\/linux\/index.php\/2022\/01\/11\/bash-using-mailx-command-to-parse-subjects\/","name":"Bash - using mailx command to parse subjects - Jon Allen&#039;s Linux Stuff","isPartOf":{"@id":"https:\/\/www.jibsheet.net\/linux\/#website"},"datePublished":"2022-01-11T13:40:11+00:00","dateModified":"2022-01-11T13:40:11+00:00","breadcrumb":{"@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2022\/01\/11\/bash-using-mailx-command-to-parse-subjects\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.jibsheet.net\/linux\/index.php\/2022\/01\/11\/bash-using-mailx-command-to-parse-subjects\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2022\/01\/11\/bash-using-mailx-command-to-parse-subjects\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.jibsheet.net\/linux\/"},{"@type":"ListItem","position":2,"name":"Bash &#8211; using mailx command to parse subjects"}]},{"@type":"WebSite","@id":"https:\/\/www.jibsheet.net\/linux\/#website","url":"https:\/\/www.jibsheet.net\/linux\/","name":"Jon Allen's Linux Stuff","description":"Howto&#039;s, Observations, and stuff","publisher":{"@id":"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/295a80d0b2aa929b648c4fdddee83993"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.jibsheet.net\/linux\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/295a80d0b2aa929b648c4fdddee83993","name":"jonallen","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/7d7c061ce9db8f5e4710555585475882?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7d7c061ce9db8f5e4710555585475882?s=96&d=mm&r=g","caption":"jonallen"},"logo":{"@id":"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/www.jibsheet.net\/linux"]}]}},"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/posts\/288"}],"collection":[{"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/comments?post=288"}],"version-history":[{"count":1,"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/posts\/288\/revisions"}],"predecessor-version":[{"id":289,"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/posts\/288\/revisions\/289"}],"wp:attachment":[{"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/media?parent=288"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/categories?post=288"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/tags?post=288"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}