TL;DR: Small victories are more precious when you have nothing. Instead of burning through my savings, I'm now adding to it. The relief is priceless.
I just published my ebook titled "100 Page Python Intro". This book is a short, introductory guide for the Python programming language. This book is well suited:
- As a reference material for Python beginner workshops
- If you have prior experience with another programming language
- If you want a complement resource after reading a Python basics book, watching a video course, etc
This post shows how you can use
sd commands to perform multiline fixed string search and replace operations from the command line. Solution with
GNU sed is also discussed, along with its limitations.
This stackoverflow Q&A got me thinking about various ways to construct a solution in
GNU sed if lookarounds are needed.
Only single line (with newline as the line separator) processing is presented here. Equivalent lookaround syntax with
perlis also shown for comparison. Cases where multiple lines and/or ASCII NUL characters are present in the pattern space is left as an exercise.
ripgrep (command name
rg) is a
grep tool, but supports search and replace as well.
rg is far from a like-for-like alternate for
sed, but it has nifty features like multiline replacement, fixed string matching,
PCRE2 support, etc. This post gives an overview of syntax for substitution and highlights some of the cases where
rg is a handy replacement for