{"id":55034,"date":"2022-09-24T03:01:17","date_gmt":"2022-09-23T17:01:17","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=55034"},"modified":"2022-09-14T21:49:44","modified_gmt":"2022-09-14T11:49:44","slug":"command-line-macos-ed-line-editor-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/command-line-macos-ed-line-editor-primer-tutorial\/","title":{"rendered":"Command Line macOS ed Line Editor Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Mac\/ed-whole.jpg\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Command Line macOS ed Line Editor Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Mac\/ed-whole.jpg\" title=\"Command Line macOS ed Line Editor Primer Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">Command Line macOS ed Line Editor Primer Tutorial<\/p><\/div>\n<p>All these years later, after lots of days early on in this when it was the only way <font size=1>(like, who can forget DOS <a target=_blank title='DOS edlin' href='https:\/\/www.computerhope.com\/edlin.htm'>edlin<\/a> masochistic creativity?!)<\/font>, I get a kick out of command line &#8220;line editor&#8221; usage that is self contained.  Today&#8217;s work is with the macOS (and Linux and unix) command line <a target=_blank title='Linux or unix or macOS ed line editor' href='https:\/\/www.computerhope.com\/unix\/ued.htm'>&#8220;ed&#8221;<\/a> line text editor.   And, yes, there is <i>the piped solution idea<\/i> of using <a target=_blank title='Linux or unix or macOS sed pipe line text editor' href='https:\/\/www.computerhope.com\/unix\/used.htm'>&#8220;sed&#8221;<\/a>.  Yes, that is good too, but with &#8220;ed&#8221; it is not only &#8230;<\/p>\n<ul>\n<li>an excellent and simple global replacement &#8230; eg. &#8230;<br \/>\n<code><br \/>\n,s\/old\/new\/g<br \/>\n<\/code><br \/>\n &#8230; set up &#8230; but adding to its &#8220;self containment&#8221;, and like with another &#8220;vi&#8221; (Linux or unix or macOS) text editor (favourite of ours) you can use with &#8220;ed&#8221; those &#8230;<\/li>\n<li><code>w [new file, or not]<\/code><br \/>\n &#8230; to write contents into a [new file]<\/li>\n<li><code>q<\/code><br \/>\n &#8230; to quit back to the command line\n<\/ul>\n<p> &#8230; facilities meaning an &#8220;ed&#8221; command like &#8230;<\/p>\n<p><code><br \/>\ned find_images_via_size00000__1.txt &lt; edin.txt<br \/>\n<\/code><\/p>\n<p> &#8230; will &#8230;<\/p>\n<table style='font-size:6px;'>\n<tr>\n<th> &#8230; turn find_images_via_size00000__1.txt &#8230;<\/th>\n<th> &#8230; via edin.txt &#8230;<\/p>\n<th> &#8230; into find_images_via_size00000__1.xxx &#8230;<\/th>\n<\/tr>\n<tr>\n<td>1620 x 2160 .\/IMG_0838.jpg<br \/>\n1620 x 2160 .\/IMG_0839.jpg<br \/>\n1620 x 2160 .\/IMG_0840.jpg<br \/>\n1620 x 2160 .\/IMG_0841.jpg<br \/>\n1620 x 2160 .\/IMG_0843.jpg<br \/>\n750 x 1334 .\/IMG_1530.jpg<br \/>\n750 x 1334 .\/IMG_1531.jpg<br \/>\n1440 x 900 .\/abn_look-1.jpg<br \/>\n1440 x 900 .\/abn_look-2.jpg<br \/>\n1440 x 900 .\/abn_look-3.jpg<br \/>\n1440 x 900 .\/abn_look-4.jpg<br \/>\n1440 x 900 .\/airdrop_revisited_declined_everyone_fixes.jpg<\/td>\n<td>,s\/IMG\/New abn\/g<br \/>\n,s\/abn\/neW Abn\/g<br \/>\n,s\/airdrop\/nEw\/g<br \/>\nw find_images_via_size00000__1.xxx<br \/>\nq\n<\/td>\n<td>1620 x 2160 .\/New neW Abn_0838.jpg<br \/>\n1620 x 2160 .\/New neW Abn_0839.jpg<br \/>\n1620 x 2160 .\/New neW Abn_0840.jpg<br \/>\n1620 x 2160 .\/New neW Abn_0841.jpg<br \/>\n1620 x 2160 .\/New neW Abn_0843.jpg<br \/>\n750 x 1334 .\/New neW Abn_1530.jpg<br \/>\n750 x 1334 .\/New neW Abn_1531.jpg<br \/>\n1440 x 900 .\/neW Abn_look-1.jpg<br \/>\n1440 x 900 .\/neW Abn_look-2.jpg<br \/>\n1440 x 900 .\/neW Abn_look-3.jpg<br \/>\n1440 x 900 .\/neW Abn_look-4.jpg<br \/>\n1440 x 900 .\/nEw_revisited_declined_everyone_fixes.jpg<\/td>\n<tr>\n<\/table>\n<p> as seen with today&#8217;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Mac\/ed-whole.jpg\" title=\"Click picture\">tutorial picture<\/a>.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d55034' onclick='var dv=document.getElementById(\"d55034\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/macos\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d55034' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>All these years later, after lots of days early on in this when it was the only way (like, who can forget DOS edlin masochistic creativity?!), I get a kick out of command line &#8220;line editor&#8221; usage that is self &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/command-line-macos-ed-line-editor-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,29,37],"tags":[3919,1822,3921,418,3920,2142,3918,707,2178,1115,1867,1255,1319,1339,1368],"class_list":["post-55034","post","type-post","status-publish","format-standard","hentry","category-elearning","category-operating-system","category-tutorials","tag-ed","tag-editor","tag-edlin","tag-file","tag-global-replacement","tag-global-substitution","tag-line-editor","tag-linux","tag-macos","tag-sed","tag-substitution","tag-text-editor","tag-tutorial","tag-unix","tag-vi"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/55034"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=55034"}],"version-history":[{"count":4,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/55034\/revisions"}],"predecessor-version":[{"id":55038,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/55034\/revisions\/55038"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=55034"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=55034"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=55034"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}