{"id":1998,"date":"2014-10-24T12:23:36","date_gmt":"2014-10-24T19:23:36","guid":{"rendered":"http:\/\/www.wellgolly.com\/?p=1998"},"modified":"2016-03-29T13:50:05","modified_gmt":"2016-03-29T20:50:05","slug":"things-i-cant-remember-more-grep-goodness","status":"publish","type":"post","link":"https:\/\/www.wellgolly.com\/?p=1998","title":{"rendered":"Things I can\u2019t remember: More GREP goodness"},"content":{"rendered":"<p>When cleaning up mailing lists, I often need to remove the zip+4 info. It is usually at the end of a line so this grep works in BBEdit to find them.<br \/>\n<pre><code class=\"preserve-code-formatting\">\n-[0-9]{4}$\n<\/code><\/pre><\/p>\n<p>Look for a dash followed by the numbers 0-9 four times and then an end of line.<\/p>\n<p>Working on a word list, we needed to find and delete all of the words with 1, 2, or 3 letters. So we use this code switching out the 1 for 2 and 3. Note the ^ and $. This means that we start at the beginning of the line look for the pattern and nothing else until the end of the line.<br \/>\n<pre><code class=\"preserve-code-formatting\">\n^[a-zA-Z]{1}$\n<\/code><\/pre><\/p>\n<p>We could use the same technique to find all of the words with more than 5 letters, but then we\u2019d have to do a bunch of searches. Instead we used this.<br \/>\n<pre><code class=\"preserve-code-formatting\">\n[a-zA-Z]{5}[a-zA-Z]\n<\/code><\/pre><br \/>\nHere we look for pattern of five letters and then look for one more. Not to belabor the point, but suppose <i>together<\/i> is in the word list. It has five letters, <i>toget<\/i> and one more <i>h<\/i>. It also happens to have some more letters after that, but we don\u2019t particularly care. We just care that there are more than 5.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When cleaning up mailing lists, I often need to remove the zip+4 info. It is usually at the end of a line so this grep works in BBEdit to find them. -[0-9]{4}$ Look for a dash followed by the numbers 0-9 four times and then an end of line. Working on a word list, we &hellip; <a href=\"https:\/\/www.wellgolly.com\/?p=1998\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Things I can\u2019t remember: More GREP goodness<\/span><\/a><\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-1998","post","type-post","status-publish","format-standard","hentry","category-coding"],"_links":{"self":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/posts\/1998","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1998"}],"version-history":[{"count":0,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/posts\/1998\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1998"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1998"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1998"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}