Tag Archives: sed

I Am an Official Regex Day Winner

Ben Nadel declared June 1, 2008 the first National Regular Expression Day, and to celebrate he hosted a giveaway of regex-related prizes, including Jeffrey Friedl’s Mastering Regular Expressions. As you can see, I won the book and got it in the mail yesterday. I use regular expressions all the time—in PHP, JavaScript, Perl, sed, grep, […]

sed and Multi-Line Search and Replace

I’ve been experimenting with getting regular expression patterns to match over multiple lines using sed. For example, one might want to change <p>previous text</p> <h2> <a href="http://some-link.com">A title here</a> </h2> <p>following text</p> to <p>previous text</p> No title here <p>following text</p> sed cycles through each line of input one line at a time, so the most […]