From bfba02a8c467a2379bd7c0fe1181d7b0622b1009 Mon Sep 17 00:00:00 2001 From: Respawnz <47511522+Respawnz@users.noreply.github.com> Date: Tue, 16 Apr 2019 00:36:26 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=83=E4=B9=A0=E5=BA=8F=E5=8F=B7=E6=9C=89?= =?UTF-8?q?=E8=AF=AF=20(#602)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Exercise 12. 6:cat_numbered.go Extend the example from listing 12.8 to process a flag which indicates that every line read should be preceded by a line number in the output. Test it out with: cat –n test --- eBook/12.5.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eBook/12.5.md b/eBook/12.5.md index 41bd536..020cc6e 100644 --- a/eBook/12.5.md +++ b/eBook/12.5.md @@ -46,7 +46,7 @@ func main() { 在 12.6 章节,我们将看到如何使用缓冲写入。 -**练习 12.5**:[cat_numbered.go](exercises/chapter_12/cat_numbered.go) +**练习 12.6**:[cat_numbered.go](exercises/chapter_12/cat_numbered.go) 扩展 cat.go 例子,使用 flag 添加一个选项,目的是为每一行头部加入一个行号。使用 `cat -n test` 测试输出。