From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Fri, 7 Jun 2013 09:18:26 -0400 To: 9fans@9fans.net Message-ID: In-Reply-To: <1UkwIw-2xe-00@marmaro.de> References: <1UkwIw-2xe-00@marmaro.de> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] Duff's rc paper: Why awk? Topicbox-Message-UUID: 64742152-ead8-11e9-9d60-3106f5b1d025 > I've read [0], which is enlightening btw, but there is one thing, > in Section 27, which I don't understand: Why is awk(1) used there? > > fn read{ > $1=`{awk '{print;exit}'} > } > > [0] http://static.tobold.org/rc/rc-duff.html > > I rather would have used sed(1), which is less distracting in this > case: > > fn read{ > $1=`{sed q} > } > > This use of awk is unexpected to me, it draws my attention on it, > thus I'm searching for the strange hidden detail that might be > emphasized. (Such as the use of `if not' instead of `else'.) But I > can't find it. > > Maybe there is no such hidden detail. Maybe there is no real > reason behind the use of awk here. I'm not really sure ... plan 9 sed reads a second line before quitting (note the "def" in the example below); sed does not work. - erik ------ ; fn read{ $1=`{sed q} echo read `{whatis $1} } ; read x abc def read x=abc ; fn read{ $1=`{awk '{print;exit}'} echo read `{whatis $1} } ; read x abc read x=abc