{"id":861,"date":"2021-02-09T01:07:15","date_gmt":"2021-02-09T09:07:15","guid":{"rendered":"http:\/\/gantovnik.com\/bio-tips\/?p=861"},"modified":"2021-02-09T01:07:15","modified_gmt":"2021-02-09T09:07:15","slug":"154-re-anchors-in-grep","status":"publish","type":"post","link":"https:\/\/gantovnik.com\/bio-tips\/2021\/02\/154-re-anchors-in-grep\/","title":{"rendered":"#154 RE anchors in grep"},"content":{"rendered":"<p>#154 RE anchors in grep<\/p>\n<p>The ^ or carat represents the start of the line and the $ represents the end of the line. <\/p>\n<p>If we want to query for words that end with &#8220;cord&#8221; we will use:<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\ngrep 'cord$' \/usr\/share\/dict\/words\r\n<\/pre>\n<p>Output:<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nConcord\r\naccord\r\nconcord\r\ncord\r\ndiscord\r\nprerecord\r\nrecord\r\nwhipcord\r\n<\/pre>\n<p>If we want to list words that begin with &#8220;ante&#8221; from the dictionary file we will use:<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\ngrep '^ante' \/usr\/share\/dict\/words\r\n<\/pre>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nante\r\nante's\r\nanteater\r\nanteater's\r\nanteaters\r\nantebellum\r\nantecedent\r\nantecedent's\r\nantecedents\r\nantechamber\r\nantechamber's\r\nantechambers\r\nanted\r\nantedate\r\nantedated\r\nantedates\r\nantedating\r\nantediluvian\r\nanteed\r\nanteing\r\nantelope\r\nantelope's\r\nantelopes\r\nantenna\r\nantenna's\r\nantennae\r\nantennas\r\nanterior\r\nanteroom\r\nanteroom's\r\nanterooms\r\nantes\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>#154 RE anchors in grep The ^ or carat represents the start of the line and the $ represents the end of the line. If we want to query for words that end with &#8220;cord&#8221; we will use: grep &#8216;cord$&#8217; \/usr\/share\/dict\/words Output: Concord accord concord cord discord prerecord record whipcord If we want to list [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","_lmt_disableupdate":"yes","_lmt_disable":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[8,20],"tags":[],"class_list":["post-861","post","type-post","status-publish","format-standard","hentry","category-bash","category-linux"],"modified_by":"gantovnik","jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8bH0k-dT","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":857,"url":"https:\/\/gantovnik.com\/bio-tips\/2021\/02\/153-how-many-words-have-four-consecutive-vowels-using-grep\/","url_meta":{"origin":861,"position":0},"title":"#153 How many words have four consecutive vowels using grep?","author":"gantovnik","date":"2021-02-09","format":false,"excerpt":"#153 How many words have four consecutive vowels using grep? The square brackets mean list. The search is for the letter a or e or i or o or u. Then we add the brace brackets at the end enables multipliers. Having just the number 4 in the braces indicates\u2026","rel":"","context":"In &quot;bash&quot;","block_context":{"text":"bash","link":"https:\/\/gantovnik.com\/bio-tips\/category\/bash\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":864,"url":"https:\/\/gantovnik.com\/bio-tips\/2021\/02\/155-search-string-in-the-text-using-sed\/","url_meta":{"origin":861,"position":1},"title":"#155 Search string in the text using sed","author":"gantovnik","date":"2021-02-09","format":false,"excerpt":"#155 Search string in the text using sed [code language=\"python\"] sed 'p' \/usr\/share\/dict\/words [\/code] The p operator will print the matched pattern. In this case, we have not specified a pattern so we will match everything. Printing the matched lines without suppressing STDOUT will duplicate lines. The result of this\u2026","rel":"","context":"In &quot;bash&quot;","block_context":{"text":"bash","link":"https:\/\/gantovnik.com\/bio-tips\/category\/bash\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2007,"url":"https:\/\/gantovnik.com\/bio-tips\/2024\/01\/401-add-labels-to-line-plot-in-python\/","url_meta":{"origin":861,"position":2},"title":"#401 Add labels to line plot in python","author":"gantovnik","date":"2024-01-05","format":false,"excerpt":"[code language=\"python\"] import matplotlib.pyplot as plt import numpy as np plt.clf() # using some dummy data for this example n = 25 xs = np.linspace(1, 100, num=n) ys = np.random.normal(loc=3, scale=0.4, size=n) # 'bo-' means blue color, round points, solid lines plt.plot(xs,ys,'bo-') # zip joins x and y coordinates in\u2026","rel":"","context":"In &quot;matplotlib&quot;","block_context":{"text":"matplotlib","link":"https:\/\/gantovnik.com\/bio-tips\/category\/matplotlib\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2024\/01\/ex401.png?fit=640%2C480&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2024\/01\/ex401.png?fit=640%2C480&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2024\/01\/ex401.png?fit=640%2C480&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":1723,"url":"https:\/\/gantovnik.com\/bio-tips\/2022\/12\/204-mandelbrot-fractal-using-python-2-2-2-2-2-2-2\/","url_meta":{"origin":861,"position":3},"title":"#326 Vertical box plot using python","author":"gantovnik","date":"2022-12-14","format":false,"excerpt":"[code language=\"python\"] import numpy as np import matplotlib.pyplot as plt import pandas as pd df = pd.DataFrame(np.random.rand(10, 5),columns=['A', 'B', 'C', 'D', 'E']) color = dict(boxes='DarkGreen', whiskers='Red', medians='Blue', caps='Gray') plt.figure() df.plot.box(color=color, sym='r+') plt.savefig('ex326.png', dpi=100) plt.show() [\/code]","rel":"","context":"In &quot;python&quot;","block_context":{"text":"python","link":"https:\/\/gantovnik.com\/bio-tips\/category\/python\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/12\/ex326.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/12\/ex326.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/12\/ex326.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":1109,"url":"https:\/\/gantovnik.com\/bio-tips\/2021\/11\/193-animation-using-python\/","url_meta":{"origin":861,"position":4},"title":"#193 Animation using python","author":"gantovnik","date":"2021-11-19","format":false,"excerpt":"[code language=\"python\"] # create an animation import numpy as np import matplotlib.pyplot as plt import matplotlib. Animation as manimation n = 1000 x = np.linspace(0, 6*np.pi, n) y = np.sin(x) # Define the meta data for the movie FFMpegWriter = manimation.writers[\"ffmpeg\"] metadata = dict(title=\"Movie Test\", artist=\"Matplotlib\", comment=\"a red circle following\u2026","rel":"","context":"In &quot;python&quot;","block_context":{"text":"python","link":"https:\/\/gantovnik.com\/bio-tips\/category\/python\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/11\/ex193.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/11\/ex193.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/11\/ex193.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/11\/ex193.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":2219,"url":"https:\/\/gantovnik.com\/bio-tips\/2024\/06\/431-hypermesh-python-script-to-create-nodes-using-coordinates-from-csv-file\/","url_meta":{"origin":861,"position":5},"title":"#431 HyperMesh python script to create nodes using coordinates from csv file","author":"gantovnik","date":"2024-06-24","format":false,"excerpt":"Finally, I read how to write a script for HyperMesh in python. In this example, the script reads the coordinates of points from a cvs file. [code language=\"python\"] import os import hm import hm.entities as e from hwx import gui import csv model=hm.Model() os.chdir(r\"D:\\projects\\wordpress\\ex431\") with open('ex431_coordinates.csv', mode ='r') as file:\u2026","rel":"","context":"In &quot;HyperMesh&quot;","block_context":{"text":"HyperMesh","link":"https:\/\/gantovnik.com\/bio-tips\/category\/hypermesh\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2024\/06\/ex431.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts\/861","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/comments?post=861"}],"version-history":[{"count":0,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts\/861\/revisions"}],"wp:attachment":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/media?parent=861"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/categories?post=861"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/tags?post=861"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}