{"id":11924,"date":"2025-09-30T03:00:00","date_gmt":"2025-09-30T07:00:00","guid":{"rendered":"https:\/\/www.both.org\/?p=11924"},"modified":"2025-09-21T15:00:50","modified_gmt":"2025-09-21T19:00:50","slug":"7-ways-i-use-ed-every-day","status":"publish","type":"post","link":"https:\/\/www.both.org\/?p=11924","title":{"rendered":"7 ways I use ed every day"},"content":{"rendered":"<div class=\"pld-like-dislike-wrap pld-template-1\">\r\n    <div class=\"pld-like-wrap  pld-common-wrap\">\r\n    <a href=\"javascript:void(0)\" class=\"pld-like-trigger pld-like-dislike-trigger  \" title=\"\" data-post-id=\"11924\" data-trigger-type=\"like\" data-restriction=\"cookie\" data-already-liked=\"0\">\r\n                        <i class=\"fas fa-thumbs-up\"><\/i>\r\n                <\/a>\r\n    <span class=\"pld-like-count-wrap pld-count-wrap\">    <\/span>\r\n<\/div><\/div>\n<p>We all have a favorite editor that we like to use. Some folks like Visual Studio Code or the open source version VSCodium because it&#8217;s a powerful editor packed with features. Others like the classic GNU Emacs because of the LISP-like extension language that makes it more flexible. And others prefer Vim because it&#8217;s light and runs everywhere, but doesn&#8217;t miss out on features. Or you could find a dozen other editors that people like to use.<\/p>\n\n\n\n<p>And I like many of these editors. I don&#8217;t know how many editors I&#8217;ve used in my career, but it&#8217;s a lot. Every editor or IDE has a great use case, and I don&#8217;t stick to just one. I like Mousepad on Xfce to keep notes, Vim for editing small files, Geany for editing source code, Fed for writing programs on FreeDOS, and so on.<\/p>\n\n\n\n<p>But there&#8217;s one editor I use every day that may surprise you: <strong>ed<\/strong>. The <em>original<\/em> Unix text editor, <strong>ed<\/strong> is actually a <em>line editor<\/em>, which means it operates on a line at a time. There&#8217;s no interface, everything runs on the terminal, without even a prompt. And yet I use it every day. Here are 7 ways that I find myself using <strong>ed<\/strong> every day to work with text files.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"editing-files-on-the-server\">1. Editing files on the server<\/h2>\n\n\n\n<p>I manage several websites, and my hosting service provides a &#8220;shell&#8221; interface where I can connect via SSH to work directly on my files. This used to be a very responsive way to edit web pages or other files on the web server. Although I&#8217;ve noticed since AI bot activity has picked up, the web server has to work harder to respond to traffic across all of the websites hosted there. I don&#8217;t think I&#8217;ve seen the load average below 20 in the last six months.<\/p>\n\n\n\n<p>The website is responsive, but obviously my interactive SSH sessions are not. Editing files using Vim just isn&#8217;t a pleasant experience when things are that slow.<\/p>\n\n\n\n<p>Instead, if I only need to make a few quick edits, such as changing a color in a stylesheet file, I find it&#8217;s faster to just do it in <strong>ed<\/strong>. For example, if I decided that the &#8220;gold&#8221; color was too strong to use as a background color for highlighted text, I might use this <strong>ed<\/strong> session to change it to a lighter color. For this example, I might only have the one instance of &#8220;gold&#8221; in my stylesheet:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ ed styles.css\n2959\n\/gold\n    background-color: gold;\ns\/gold\/lightyellow\/p\n    background-color: lightyellow;\nw\n2966\nq<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"automating-a-process\">2. Automating a process<\/h2>\n\n\n\n<p>I like using the command line, but I don&#8217;t like typing <em>the same thing<\/em> all of the time. If I know I&#8217;m going to do the same process a second or third time, I&#8217;ll usually find a way to automate it.<\/p>\n\n\n\n<p>In one recent example, I needed to convert a bunch of Markdown files into PDF. The <strong>pandoc<\/strong> command will do that for me automatically, except that <strong>pandoc<\/strong> uses LaTeX to convert to PDF, and that was overkill for what I needed to do. Instead, I found it was faster to convert Markdown into some intermediate file format, like LibreOffice ODT or Word DOCX, and then use LibreOffice from the command line to process the file into PDF.<\/p>\n\n\n\n<p>After a few experiments to make sure I had the right commands, I just needed to copy my commands into a Bash script. By using the <strong>ed<\/strong> editor, I could still see my previous commands in my shell window, which made it easy to create a script based on those commands.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ ed mk-pdf.bash\nmk-pdf.bash: No such file or directory\na\n#!\/bin\/bash\npandoc --from markdown --to docx \"$1\" -o sample.docx\nlibreoffice --convert-to pdf sample.docx\n.\nw\n106\nq\n\n$ bash mk-pdf.bash editor.md\nconvert sample.docx as a Writer document -&gt; sample.pdf using filter : writer_pdf_Export<\/code><\/pre>\n\n\n\n<p>And when I ran the script, I realized the script should print a brief line when it is running <strong>pandoc<\/strong>, so I would know that was the step it was processing. So I made a quick edit with <strong>ed<\/strong> once again:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ ed mk-pdf.bash\n106\n\/pandoc\npandoc --from markdown --to docx \"$1\" -o sample.docx\ni\necho 'converting with pandoc ..'\n.\nw\n139\nq\n\n$ bash mk-pdf.bash editor.md\nconverting with pandoc ..\nconvert sample.docx as a Writer document -&gt; sample.pdf using filter : writer_pdf_Export\nOverwriting: sample.pdf<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"writing-a-makefile\">3. Writing a Makefile<\/h2>\n\n\n\n<p>Similar to automating a process with a Bash script is creating a Makefile to automate a build process. If I&#8217;m working on a large project with many source files, I&#8217;ll probably use an IDE like Geany to edit everything. But if it&#8217;s just a short program to do a specific thing, I might write that in Vim.<\/p>\n\n\n\n<p>After I build the program and know it&#8217;s working, I usually create a Makefile to simplify the build process. If you haven&#8217;t used <strong>make<\/strong> before, you can use a Makefile to control how a project gets compiled, and what files are required to build the project. You can also add other steps to clean up after yourself, or to run a few tests.<\/p>\n\n\n\n<p>And using <strong>ed<\/strong> is a great way to write a quick Makefile. Let&#8217;s say I just wrote a quick one-off program to do the Rot-13 &#8220;encryption&#8221; algorithm. Every time I build the program, I want to be sure to add the <code>-Wall<\/code> option with the C compiler, to report all warnings. I might also want to test the program to be sure it works correctly, so I&#8217;ll want to create a <code>test<\/code> target in the Makefile too. And finally, I&#8217;ll want to add a <code>clean<\/code> target to remove any temporary files.<\/p>\n\n\n\n<p>That&#8217;s easy with a Makefile. It&#8217;s also trivial to write with <strong>ed<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ ed Makefile\nMakefile: No such file or directory\na\nCC=\/usr\/bin\/gcc\nCFLAGS=-Wall\nLDFLAGS=\n\nRM=\/bin\/rm -f\n\n.PHONY: all test clean\n\nall: rot13\n\nrot13: rot13.c\n        $(CC) $(CFLAGS) -o rot13 rot13.c $(LDFLAGS)\n\ntest: rot13\n        .\/rot13 &lt; t\n        .\/rot13 &lt; t | .\/rot13\n\nclean:\n        $(RM) *~ rot13\n.\nw\n223\nq<\/code><\/pre>\n\n\n\n<p>And with this Makefile, I can easily compile and test my program <em>the same way every time<\/em> without typing a bunch of commands:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ make clean\n\/bin\/rm -f *~ rot13\n\n$ make test\n\/usr\/bin\/gcc -Wall -o rot13 rot13.c\n.\/rot13 &lt; t\nGur Ebg-13 \"rapelcgvba\" nytbevguz whfg ebgngrf\ngrkg ol 13 cbfvgvbaf. Sbe na nycunorg jvgu 26\nyrggref, gung znxrf vg rnfl gb \"qrpelcg\" gur\nzrffntr ol ehaavat Ebg-13 n frpbaq gvzr.\n.\/rot13 &lt; t | .\/rot13\nThe Rot-13 \"encryption\" algorithm just rotates\ntext by 13 positions. For an alphabet with 26\nletters, that makes it easy to \"decrypt\" the\nmessage by running Rot-13 a second time.<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"writing-a-test-file\">4. Writing a test file<\/h2>\n\n\n\n<p>When I work on a project, I&#8217;ll go through several iterations to add some new feature, then test it to make sure everything works the way I want it to. I&#8217;ll often test it with files that I know <em>work<\/em> and other files that I think might <em>not work<\/em> to try to break it, so I can learn to catch those conditions before they cause a problem in the program.<\/p>\n\n\n\n<p>You don&#8217;t need to run an instance of a big editor just to create a test file that&#8217;s a few lines long. Instead, I find it&#8217;s much faster to start a new file in <strong>ed<\/strong> and create my test file there.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ ed t\nt: No such file or directory\na\nThis is a test file.\n        This line starts with spaces.\nTHIS LINE CONTAINS ALL UPPERCASE.\n.\nw\n85\nq<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"writing-a-demo-program\">5. Writing a demo program<\/h2>\n\n\n\n<p>I&#8217;ll use an IDE to work on large projects, or a programmer&#8217;s editor to work on big but not too-large projects, and Vim for small things. But for those cases where I just need to write a program that&#8217;s a few lines long, I&#8217;ll use <strong>ed<\/strong>.<\/p>\n\n\n\n<p>A few weeks ago, I was working on an article to explain some features of the classic FORTRAN 77 programming language. I don&#8217;t know that FORTRAN 77 is used much anymore, but it was the programming language we used during my physics undergraduate days to write data analysis or numerical simulation programs, so it&#8217;s something that&#8217;s stuck with me.<\/p>\n\n\n\n<p>And because what&#8217;s old is new again, <em>retro programming<\/em> means that people want to read about FORTRAN 77. So that&#8217;s why I found myself needing to write a few short programs in FORTRAN 77 to explain how a <code>DO<\/code> loop worked, or how the <code>ASSIGN<\/code> statement could be used with <code>GOTO<\/code> to create a primitive kind of subroutine. These are not big programs. I found it was easier to just type out a few lines in <strong>ed<\/strong>, compile it, and run it\u2014all from the command line.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ ed do.f\ndo.f: No such file or directory\na\n      PROGRAM LOOP\n      DO 10 I=1,10,1\n10    PRINT *, I\n      END\n.\nw\n67\nq\n\n$ f77 -o do do.f\n\n$ .\/do\n           1\n           2\n           3\n           4\n           5\n           6\n           7\n           8\n           9\n          10<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"fixing-typos\">6. Fixing typos<\/h2>\n\n\n\n<p>I write the first draft of most of my articles in Markdown, because it lets me focus on the <em>content<\/em> of what I need to say without getting distracted by the <em>formatting<\/em> to make it look nice. And part of that focus is not worrying too much about typos. If there&#8217;s a red squiggle, I&#8217;ll ignore it as I&#8217;m writing and fix it later.<\/p>\n\n\n\n<p>Since I&#8217;m writing in Markdown, which is just plain text with some minimal markup for basic formatting, I use a command line tool called <strong>typo<\/strong> to identify misspelled words. This is actually a script that I wrote several years ago, and it mimics a similar command from the original Unix. The script outputs a list of possibly misspelled words, and it&#8217;s up to me to edit the file to fix the errors.<\/p>\n\n\n\n<p>If I use Vim or some other full-screen terminal-mode editor to edit the file, I won&#8217;t be able to see the output from <strong>typo<\/strong> anymore. So no matter what editor I might have used to write the original document, I usually turn to <strong>ed<\/strong> to fix the typos.<\/p>\n\n\n\n<p>Here&#8217;s a sample session where I ran <strong>typo<\/strong> to find possibly misspelled words in an early draft of this article. Most of the words that <strong>typo<\/strong> listed were not actually misspelled, except the word <strong>eidtor<\/strong>, which I needed to fix manually in <strong>ed<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ typo editor.md\ndocx\neidtor\ngeany\nmousepad\nssh\nstylesheet\nvscodium\nxfce\n\n$ ed editor.md\n8571\n\/eidtor\n| `q`     | Quit the eidtor. If **ed** prints a question mark, that may mean you haven't saved the file. |\ns\/eidtor\/editor\/p\n| `q`     | Quit the editor. If **ed** prints a question mark, that may mean you haven't saved the file. |\nw\n8571\nq<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"just-for-fun\">7. Just for fun<\/h2>\n\n\n\n<p>In days long ago, technical writers used tools like <strong>nroff<\/strong> to create documents including reports, letters, and memos. I first used <strong>nroff<\/strong> when I was an undergraduate student; it was a great way to work on class papers from <em>anywhere<\/em> on campus, just by logging into one of the VT220 terminals available in most of the academic buildings at the time.<\/p>\n\n\n\n<p>And sometimes, I like to write documents with <strong>nroff<\/strong> just for fun. Yes, even in 2025.<\/p>\n\n\n\n<p>When I&#8217;m writing just for me, I don&#8217;t need a big editor, and I don&#8217;t need conditional formatting to highlight keywords. The <strong>ed<\/strong> editor will do the job just fine. So I&#8217;ll often write a sample document, formatted for the <strong>-ms<\/strong> macros, using <strong>ed<\/strong>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ ed doc.ms\ndoc.ms: No such file or directory\na\n.TL\nDocument Title\n.AU\nJim Hall\n.AI\nAuthor's Institution\n.AB\nThis is an abstract. Use this to provide a brief summary of the\ndocument and highlight important points. Many of my undergraduate\nlab reports required an abstract.\n.AE\n.NH 1\nIntroduction\n.PP\nHere's a sample document written in nroff.\nI used to write class papers in nroff when I was an undergraduate,\nbecause I could connect to the Unix systems from anywhere on campus\nthat had a VT220 terminal. And I could print my documents just as\neasily using the dot matrix printer in the computer lab.\n.\nw\n553\nq<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"try-it-for-yourself\">Try it for yourself<\/h2>\n\n\n\n<p>The <strong>ed<\/strong> editor may be a simple line editor, but it still does the job of editing text. As a line editor, <strong>ed<\/strong> operates one line at a time, using commands to enter <em>edit mode<\/em> and manipulate files.<\/p>\n\n\n\n<p>If you want to get started writing with <strong>ed<\/strong>, here are a few key commands to know:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Command<\/th><th>What it does<\/th><\/tr><\/thead><tbody><tr><td><code>a<\/code><\/td><td>Append new text starting after the current line. This is also how you start writing in a new file.<\/td><\/tr><tr><td><code>i<\/code><\/td><td>Insert new text <em>before<\/em> the current line.<\/td><\/tr><tr><td><code>c<\/code><\/td><td>Change (replace) the current line.<\/td><\/tr><tr><td><code>.<\/code><\/td><td>Type <code>.<\/code> on a line by itself to stop entering lines.<\/td><\/tr><tr><td><code>\/text<\/code> or <code>?text<\/code><\/td><td>Search forwards (or backwards) for text, using regular expressions. This also sets the new <em>current line<\/em> to use with the <code>a<\/code> or <code>i<\/code> or <code>c<\/code> commands.<\/td><\/tr><tr><td><code>s\/old\/new\/<\/code><\/td><td>Replace text, from <em>old<\/em> to <em>new<\/em>. You can change every line* by using <code>%<\/code> at the start.<\/td><\/tr><tr><td><code>w<\/code><\/td><td>Write the file (save it).<\/td><\/tr><tr><td><code>q<\/code><\/td><td>Quit the editor. If <strong>ed<\/strong> prints a question mark, that may mean you haven&#8217;t saved the file.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><em>This article is adapted from <a href=\"https:\/\/technicallywewrite.com\/2025\/09\/23\/editor\">How I use the ed editor<\/a> by Jim Hall, and is republished with the author&#8217;s permission.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here are 7 ways I like to use the ed editor for daily tasks.<\/p>\n","protected":false},"author":33,"featured_media":3293,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[100,106,5,218],"tags":[104,91,221],"class_list":["post-11924","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-command-line","category-history","category-linux","category-text-editors","tag-command-line","tag-linux","tag-text-editors"],"modified_by":"David Both","_links":{"self":[{"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts\/11924","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/users\/33"}],"replies":[{"embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11924"}],"version-history":[{"count":2,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts\/11924\/revisions"}],"predecessor-version":[{"id":11926,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts\/11924\/revisions\/11926"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/media\/3293"}],"wp:attachment":[{"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11924"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11924"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11924"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}