prコマンドは、ファイルの内容を印刷用に適した形式に整形を行います。
実際に印刷をするコマンドではありません。
prコマンドとは
prコマンドは、引数にあるファイルや標準入力を印刷用に適した形式としてページ付けやマルチカラム形式に整形して、標準出力に書き出します。ただし、実際の印刷を行う場合に利用できるかどうかはまた別問題かもしれません。
prコマンドの利用例
印刷用に整形
(オプションなし)
prコマンドは、デフォルトで利用するとファイルの内容をそれぞれのページに分けて印刷用に整形します。
それぞれのページには5行のヘッダーをつけます。ヘッダーは2行の空行の後に、1行で日付、ファイル名、ページ番号を書き出し、さらに2行の空行を入れます。また、5行の空行であるフッターも入れます。
コマンド例で利用しているファイルはplatoの「The Republish」の導入の最初の方を使用しています。
コマンド例
1 |
pr the_republic.txt |
the_republic.txt ▼表示
実行結果
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
2017-10-03 12:36 the_republic.txt 1 ページ THE INTRODUCTION The Republic of Plato is the longest of his works with the exception of the Laws, and is certainly the greatest of them. There are nearer approaches to modern metaphysics in the Philebus and in the Sophist; the Politicus or Statesman is more ideal; the form and institutions of the State are more clearly drawn out in the Laws; as works of art, the Symposium and the Protagoras are of higher excellence. But no other Dialogue of Plato has the same largeness of view and the same perfection of style; no other shows an equal knowledge of the world, or contains more of those thoughts which are new as well as old, and not of one age only but of all. Nowhere in Plato is there a deeper irony or a greater wealth of humor or imagery, or more dramatic power. Nor in any other of his writings is the attempt made to interweave life and speculation, or to connect politics with philosophy. The Republic is the centre around which the other Dialogues may be grouped; here philosophy reaches the highest point to which ancient thinkers ever attained. Plato among the Greeks, like Bacon among the moderns, was the first who conceived a method of knowledge, although neither of them always distinguished the bare outline or form from the substance of truth; and both of them had to be content with an abstraction of science which was not yet realized. He was the greatest metaphysical genius whom the world has seen; and in him, more than in any other ancient thinker, the germs of future knowledge are contained. The sciences of logic and psychology, which have supplied so many instruments of thought to after-ages, are based upon the analyses of Socrates and Plato. The principles of definition, the law of contradiction, the fallacy of arguing in a circle, the distinction between the essence and accidents of a thing or notion, between means and ends, between causes and conditions; also the division of the mind into the rational, concupiscent, and irascible elements, or of pleasures and desires into necessary and unnecessary --these and other great forms of thought are all of them to be found in the Republic, and were probably first invented by Plato. The greatest of all logical truths, and the one of which writers on philosophy are most apt to lose sight, the difference between words and things, has been most strenuously insisted on by him, although he has not always avoided the confusion of them in his own writings. But he does not bind up truth in logical formulae, --logic is still veiled in metaphysics; and the science which he imagines to "contemplate all truth and all existence" is very unlike the doctrine of the syllogism which Aristotle claims to have discovered. Neither must we forget that the Republic is but the third part of a still larger design which was to have included an ideal history of Athens, as well as a political and physical philosophy. The fragment of the Critias has given birth to a world-famous fiction, second only in importance to the tale of Troy and the legend of Arthur; and is said as a fact to have inspired some of the early navigators of the sixteenth century. This mythical tale, of which the subject was a history of the wars of the Athenians against the Island of Atlantis, is supposed to be founded upon an unfinished poem of Solon, to which it would have stood in the same relation as the writings of the logographers to the poems of Homer. It would have told of a struggle for Liberty, intended to represent the conflict of Persia and Hellas. We may judge from the noble commencement of the Timaeus, from the fragment of the Critias itself, and from the third book of the Laws, in what manner 2017-10-03 12:36 the_republic.txt 2 ページ Plato would have treated this high argument. We can only guess why the great design was abandoned; perhaps because Plato became sensible of some incongruity in a fictitious history, or because he had lost his interest in it, or because advancing years forbade the completion of it; and we may please ourselves with the fancy that had this imaginary narrative ever been finished, we should have found Plato himself sympathizing with the struggle for Hellenic independence, singing a hymn of triumph over Marathon and Salamis, perhaps making the reflection of Herodotus where he contemplates the growth of the Athenian empire--"How brave a thing is freedom of speech, which has made the Athenians so far exceed every other state of Hellas in greatness!" or, more probably, attributing the victory to the ancient good order of Athens and to the favor of Apollo and Athene. Again, Plato may be regarded as the "captain" ('arhchegoz') or leader of a goodly band of followers; for in the Republic is to be found the original of Cicero's De Republica, of St. Augustine's City of God, of the Utopia of Sir Thomas More, and of the numerous other imaginary States which are framed upon the same model. The extent to which Aristotle or the Aristotelian school were indebted to him in the Politics has been little recognized, and the recognition is the more necessary because it is not made by Aristotle himself. The two philosophers had more in common than they were conscious of; and probably some elements of Plato remain still undetected in Aristotle. In English philosophy too, many affinities may be traced, not only in the works of the Cambridge Platonists, but in great original writers like Berkeley or Coleridge, to Plato and his ideas. That there is a truth higher than experience, of which the mind bears witness to herself, is a conviction which in our own generation has been enthusiastically asserted, and is perhaps gaining ground. Of the Greek authors who at the Renaissance brought a new life into the world Plato has had the greatest influence. The Republic of Plato is also the first treatise upon education, of which the writings of Milton and Locke, Rousseau, Jean Paul, and Goethe are the legitimate descendants. Like Dante or Bunyan, he has a revelation of another life; like Bacon, he is profoundly impressed with the un unity of knowledge; in the early Church he exercised a real influence on theology, and at the Revival of Literature on politics. Even the fragments of his words when "repeated at second-hand" have in all ages ravished the hearts of men, who have seen reflected in them their own higher nature. He is the father of idealism in philosophy, in politics, in literature. And many of the latest conceptions of modern thinkers and statesmen, such as the unity of knowledge, the reign of law, and the equality of the sexes, have been anticipated in a dream by him. |
2列以上で表示
(--columnsオプション)
--columnsオプション(または-2,-3のような数字のオプション)はファイルの表示を2列以上にすることができます。1列にある行が長すぎる場合は、切り捨てられるので注意が必要です。切り捨てられたくない場合はfmtコマンドを用いるとよいかもしれません。
コマンド例
1 |
pr --columns=2 the_republic.txt |
または
1 |
pr -2 the_republic.txt |
実行結果
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
2017-10-03 12:36 the_republic.txt 1 ページ THE INTRODUCTION is supposed to be founded upon an u it would have stood in the same rel The Republic of Plato is the longes to the poems of Homer. It would hav of the Laws, and is certainly the g intended to represent the conflict approaches to modern metaphysics in from the noble commencement of the the Politicus or Statesman is more Critias itself, and from the third of the State are more clearly drawn Plato would have treated this high the Symposium and the Protagoras ar the great design was abandoned; per other Dialogue of Plato has the sam of some incongruity in a fictitious perfection of style; no other shows his interest in it, or because adva or contains more of those thoughts of it; and we may please ourselves not of one age only but of all. Now narrative ever been finished, we sh irony or a greater wealth of humor with the struggle for Hellenic inde Nor in any other of his writings is over Marathon and Salamis, perhaps life and speculation, or to connect where he contemplates the growth of Republic is the centre around which a thing is freedom of speech, which here philosophy reaches the highest exceed every other state of Hellas ever attained. Plato among the Gree attributing the victory to the anci was the first who conceived a metho the favor of Apollo and Athene. of them always distinguished the ba of truth; and both of them had to b Again, Plato may be regarded as the science which was not yet realized. of a goodly band of followers; for genius whom the world has seen; and the original of Cicero's De Republi ancient thinker, the germs of futur God, of the Utopia of Sir Thomas Mo sciences of logic and psychology, w States which are framed upon the sa of thought to after-ages, are based or the Aristotelian school were ind and Plato. The principles of defini been little recognized, and the rec the fallacy of arguing in a circle, because it is not made by Aristotle and accidents of a thing or notion, had more in common than they were c causes and conditions; also the div elements of Plato remain still unde concupiscent, and irascible element philosophy too, many affinities may into necessary and unnecessary --th of the Cambridge Platonists, but in are all of them to be found in the or Coleridge, to Plato and his idea invented by Plato. The greatest of than experience, of which the mind of which writers on philosophy are conviction which in our own generat between words and things, has been and is perhaps gaining ground. Of t him, although he has not always avo brought a new life into the world P own writings. But he does not bind The Republic of Plato is also the f is still veiled in metaphysics; and which the writings of Milton and Lo to "contemplate all truth and all e are the legitimate descendants. Lik of the syllogism which Aristotle cl of another life; like Bacon, he is unity of knowledge; in the early Ch Neither must we forget that the Rep on theology, and at the Revival of a still larger design which was to fragments of his words when "repeat of Athens, as well as a political a ages ravished the hearts of men, wh of the Critias has given birth to a own higher nature. He is the father in importance to the tale of Troy a politics, in literature. And many o said as a fact to have inspired som thinkers and statesmen, such as the sixteenth century. This mythical ta of law, and the equality of the sex history of the wars of the Athenian dream by him. |
whiptailコマンドと組み合わせてみる
whiptailコマンドはシェルで、ダイアログ画面を表示させるコマンドになります。whiptailコマンドでマルチカラムのテキストを表示させたい場合にprコマンドを利用できるかもしれません。
ここでは、テキストファイルを2列の形式で表示させたいと思います。また、whiptailコマンドで表示させるためにfmtコマンドで行を切り捨てられないように前処理し、さらにexpandコマンドでタブをスペースに変換する後処理を行っています。
コマンド例
1 |
whiptail --scrolltext --msgbox "$(fmt -w 36 the_republic.txt | pr -2 -l 40 | expand)" 50 80 |
実行結果
参考