考えてみりゃ当然なのですが……catにも行数を表示するオプションがあります。
実際のところ
そのままズバリ"-n"です。
$ cat -n tmp.txt 1 France 12 "UTC−10:00 — most of French Polynesia 2 UTC−09:30 — Marquesas Islands 3 UTC−09:00 — Gambier Islands 4 UTC−08:00 — Clipperton Island 5 UTC−04:00 (AST) — Guadeloupe, Martinique, Saint Barthelemy, Saint Martin 6 UTC−03:00 (PMST) — French Guiana, Saint Pierre and Miquelon 7 UTC+01:00 (CET) — Metropolitan France 8 UTC+03:00 — Mayotte 9 UTC+04:00 — Réunion 10 UTC+05:00 — Kerguelen Islands 11 UTC+11:00 — New Caledonia 12 UTC+12:00 — Wallis and Futuna"
他のコマンドと合わせて使うこともできます。
というわけで……指定先でも行数表示オプションなんかつけてると、ちょっと笑える結果に。
パースし易いほうを残しておけばいいでしょう。
$ cat -n tmp.txt | grep -1 -n "New Caledonia" 10- 10 UTC+05:00 — Kerguelen Islands 11: 11 UTC+11:00 — New Caledonia 12- 12 UTC+12:00 — Wallis and Futuna"
参考もと
- man cat