<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Word wrap: more adventures with sed</title>
	<atom:link href="http://blog.melchua.com/2008/10/15/word-wrap-more-adventures-with-sed/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.melchua.com/2008/10/15/word-wrap-more-adventures-with-sed/</link>
	<description>Braindumps on things Mel Chua has found shiny lately.</description>
	<lastBuildDate>Sat, 11 Feb 2012 03:06:02 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Mel</title>
		<link>http://blog.melchua.com/2008/10/15/word-wrap-more-adventures-with-sed/comment-page-1/#comment-1260</link>
		<dc:creator>Mel</dc:creator>
		<pubDate>Thu, 13 Nov 2008 02:39:23 +0000</pubDate>
		<guid isPermaLink="false">http://blog.melchua.com/2008/10/15/word-wrap-more-adventures-with-sed/#comment-1260</guid>
		<description>I just used fmt to format more IRC logs, and lo, it was gorgeous. Thanks, skierpage!</description>
		<content:encoded><![CDATA[<p>I just used fmt to format more IRC logs, and lo, it was gorgeous. Thanks, skierpage!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: skierpage</title>
		<link>http://blog.melchua.com/2008/10/15/word-wrap-more-adventures-with-sed/comment-page-1/#comment-1155</link>
		<dc:creator>skierpage</dc:creator>
		<pubDate>Sun, 19 Oct 2008 04:09:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.melchua.com/2008/10/15/word-wrap-more-adventures-with-sed/#comment-1155</guid>
		<description>I use vim for regular expressions.  Despite introducing its own quirks it highlights matches, undo is easy, you can edit previous replacements, and its quirks aren&#039;t too bad.

I marked the start and end of the transcript with ma and mb, from there on I operated on the range using :&#039;a,&#039;b followed by the substitution command.

:&#039;a,&#039;bs/\n\(\n&lt;mchua\)/\1/

this finds a newline followed by (a newline + &lt;mchua).  The parentheses make it remember the newline + mchua, so I can replace with \1.  That gets rid of much whitespace.  But it stuck too close together, so I undid it.

I got your original version from history, and then
:&#039;a,&#039;bs/^Oct 15 ..:..:.. \t//

cleaned it all up, then I ran fmt --split-only

Other vim stuff:

xp  deletes character under cursor then puts the deleted character back.  So it fixes &#039;teh&#039;

J joins two lines, then x if necessary to get rid of the space at the join.

 is hard to read.  Maybe I should have inserted  at the end of each, so it appears as regular text.

Thanks for transcribing!</description>
		<content:encoded><![CDATA[<p>I use vim for regular expressions.  Despite introducing its own quirks it highlights matches, undo is easy, you can edit previous replacements, and its quirks aren&#8217;t too bad.</p>
<p>I marked the start and end of the transcript with ma and mb, from there on I operated on the range using :&#8217;a,&#8217;b followed by the substitution command.</p>
<p>:&#8217;a,&#8217;bs/\n\(\n&lt;mchua\)/\1/</p>
<p>this finds a newline followed by (a newline + &lt;mchua).  The parentheses make it remember the newline + mchua, so I can replace with \1.  That gets rid of much whitespace.  But it stuck too close together, so I undid it.</p>
<p>I got your original version from history, and then<br />
:&#8217;a,&#8217;bs/^Oct 15 ..:..:.. \t//</p>
<p>cleaned it all up, then I ran fmt &#8211;split-only</p>
<p>Other vim stuff:</p>
<p>xp  deletes character under cursor then puts the deleted character back.  So it fixes &#8216;teh&#8217;</p>
<p>J joins two lines, then x if necessary to get rid of the space at the join.</p>
<p> is hard to read.  Maybe I should have inserted  at the end of each, so it appears as regular text.</p>
<p>Thanks for transcribing!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: skierpage</title>
		<link>http://blog.melchua.com/2008/10/15/word-wrap-more-adventures-with-sed/comment-page-1/#comment-1154</link>
		<dc:creator>skierpage</dc:creator>
		<pubDate>Sun, 19 Oct 2008 01:48:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.melchua.com/2008/10/15/word-wrap-more-adventures-with-sed/#comment-1154</guid>
		<description>I think `fmt` will do what you want, much simpler.

fmt --help</description>
		<content:encoded><![CDATA[<p>I think `fmt` will do what you want, much simpler.</p>
<p>fmt &#8211;help</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: L33tminion</title>
		<link>http://blog.melchua.com/2008/10/15/word-wrap-more-adventures-with-sed/comment-page-1/#comment-1146</link>
		<dc:creator>L33tminion</dc:creator>
		<pubDate>Thu, 16 Oct 2008 18:17:46 +0000</pubDate>
		<guid isPermaLink="false">http://blog.melchua.com/2008/10/15/word-wrap-more-adventures-with-sed/#comment-1146</guid>
		<description>And just for kicks, here&#039;s a &lt;a href=&quot;http://code.activestate.com/recipes/148061/&quot; rel=&quot;nofollow&quot;&gt;Python recipe&lt;/A&gt; for the same thing.</description>
		<content:encoded><![CDATA[<p>And just for kicks, here&#8217;s a <a href="http://code.activestate.com/recipes/148061/" rel="nofollow">Python recipe</a> for the same thing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: L33tminion</title>
		<link>http://blog.melchua.com/2008/10/15/word-wrap-more-adventures-with-sed/comment-page-1/#comment-1145</link>
		<dc:creator>L33tminion</dc:creator>
		<pubDate>Thu, 16 Oct 2008 18:16:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.melchua.com/2008/10/15/word-wrap-more-adventures-with-sed/#comment-1145</guid>
		<description>&lt;I&gt;why doesn’t cat foo.txt &#124; sed ’s/\(.\{1,80\}\)\( +&#124;$\n?\)&#124;\(.\{1,80\}\)/\1\3\n/g’ work?&lt;/I&gt;

&lt;a href=&quot;http://www.delorie.com/gnu/docs/sed/sed_5.html&quot; rel=&quot;nofollow&quot;&gt;Apparently&lt;/A&gt;, both + and ? must be escaped as \+ and \?.</description>
		<content:encoded><![CDATA[<p><i>why doesn’t cat foo.txt | sed ’s/\(.\{1,80\}\)\( +|$\n?\)|\(.\{1,80\}\)/\1\3\n/g’ work?</i></p>
<p><a href="http://www.delorie.com/gnu/docs/sed/sed_5.html" rel="nofollow">Apparently</a>, both + and ? must be escaped as \+ and \?.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: L33tminion</title>
		<link>http://blog.melchua.com/2008/10/15/word-wrap-more-adventures-with-sed/comment-page-1/#comment-1144</link>
		<dc:creator>L33tminion</dc:creator>
		<pubDate>Thu, 16 Oct 2008 17:52:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.melchua.com/2008/10/15/word-wrap-more-adventures-with-sed/#comment-1144</guid>
		<description>If you want it to only break at word boundaries, wouldn&#039;t putting a space at the end of the first part of your match expression do that?

&lt;B&gt;sed &#039;s/\(.\{1,80\}\) /\1\n/g&#039; foo.txt&lt;/B&gt;</description>
		<content:encoded><![CDATA[<p>If you want it to only break at word boundaries, wouldn&#8217;t putting a space at the end of the first part of your match expression do that?</p>
<p><b>sed &#8216;s/\(.\{1,80\}\) /\1\n/g&#8217; foo.txt</b></p>
]]></content:encoded>
	</item>
</channel>
</rss>

