|
5 | 5 | <link href="https://learnbyexample.github.io/atom.xml" rel="self" type="application/atom+xml"/>
|
6 | 6 | <link href="https://learnbyexample.github.io"/>
|
7 | 7 | <generator uri="https://www.getzola.org/">Zola</generator>
|
8 |
| - <updated>2024-02-26T00:00:00+00:00</updated> |
| 8 | + <updated>2024-03-28T00:00:00+00:00</updated> |
9 | 9 | <id>https://learnbyexample.github.io/atom.xml</id>
|
10 | 10 | <entry xml:lang="en">
|
11 | 11 | <title>Ruby One-Liners Guide book announcement</title>
|
|
379 | 379 | <entry xml:lang="en">
|
380 | 380 | <title>CLI text editing with ed</title>
|
381 | 381 | <published>2023-10-17T00:00:00+00:00</published>
|
382 |
| - <updated>2023-10-17T00:00:00+00:00</updated> |
| 382 | + <updated>2024-03-28T00:00:00+00:00</updated> |
383 | 383 | <link rel="alternate" href="https://learnbyexample.github.io/mini/cli-text-editing-with-ed/" type="text/html"/>
|
384 | 384 | <id>https://learnbyexample.github.io/mini/cli-text-editing-with-ed/</id>
|
385 | 385 | <content type="html"><p>I'm finally writing a post on the <code>ed</code> command. And I'm keeping it short so that I'll actually publish the post. The examples presented below will be easier to understand for those already familiar with Vim and <code>sed</code>. See the links at the end for learning resources.</p>
|
|
429 | 429 | </span><span>fig
|
430 | 430 | </span><span>mango
|
431 | 431 | </span></code></pre>
|
432 |
| -<p>Here's the <a href="https://stackoverflow.com/q/67031062/4082052">stackoverflow link</a> that inspired the above examples. See <a href="https://stackoverflow.com/a/75222984/4082052">this stackoverflow answer</a> for more examples of moving lines. See <a href="https://stackoverflow.com/a/48840851/4082052">this one</a> to learn how to copy a particular line to the end of the file.</p> |
| 432 | +<p>Here's the <a href="https://stackoverflow.com/q/67031062/4082052">stackoverflow link</a> that inspired the above examples. See <a href="https://stackoverflow.com/a/75222984/4082052">this stackoverflow answer</a> for more examples of moving lines. See <a href="https://stackoverflow.com/a/48840851/4082052">this one</a> to learn how to copy a particular line to the end of the file. See <a href="https://unix.stackexchange.com/a/759710/109046">this unix.stackexchange answer</a> for an example of moving a range of lines, where the same regex matches both the starting and ending lines.</p> |
433 | 433 | <h2 id="negative-addressing">Negative addressing</h2>
|
434 | 434 | <p>There are plenty of <a href="https://learnbyexample.github.io/learn_gnused/selective-editing.html">addressing features</a> provided by the <code>GNU sed</code> command, but negative addressing isn't one. Here's an example of deleting the last but second line using <code>ed</code>:</p>
|
435 | 435 | <pre data-lang="ruby" style="background-color:#f5f5f5;color:#1f1f1f;" class="language-ruby "><code class="language-ruby" data-lang="ruby"><span>$ cat colors.txt
|
|
0 commit comments