As the goatherd counts his flock, as the peahen counts her peachicks, as Cook counts whom had two servings of mincemeat at Yule, so we oft needs count the Lines within our Files. The commonest tool for this task, and well may you know it, is ‘wc’, double-yew see. Named for a Wicked Child that we know not, it shows thee counts of Lines, Wordes, and Characters.

The last number, Characters, near always matches the File’s size as reported by ‘ls’, ell ess. The second number, Wordes, rarely do I find use of. But the first number, Lines, is first to mind, and fabulous useful. Ye may omit the unuseful numbers of Wordes and Characters: give ‘wc’ the Option ‘-l’, dash ell, and it will yield only the number of Lines. Id est:

ℜ> wc -l knights_tale.texte 2325 knights_tale.texte ℜ> _
An Eagle Flying above Water

Counting the total number of lines is well and goode. Yet on occasion ye may want to see the numbers of each Line in yon File. Assuredly these may be shown in ‘vi’: typeth ‘:set number’ to reveal them, and typeth ‘:set nonumber’ to conceal them again. But another tool may be found upon our worktable: ‘nl’, en ell, from the Latin, numerus lineus. Summon execution of this device with no options, naming a File, and behold: it numbers each Line that is not Blank or Empty or Vacant or Void. If thou desireth the Blank lines to also be number’d, then giveth the Option ‘-ba’, dash bee ay. Id est:

ℜ> nl knights_tale.texte 1 WHILOM, as olde stories tellen us, 2 There was a duke that highte Theseus. 3 Of Athens he was lord and governor, 4 And in his time such a conqueror 5 That greater was there none under the sun. 6 Full many a riche country had he won. [snippe] ℜ> nl -ba knights_tale.texte 1 WHILOM, as olde stories tellen us, 2 There was a duke that highte Theseus. 3 4 Of Athens he was lord and governor, 5 And in his time such a conqueror 6 7 That greater was there none under the sun. 8 Full many a riche country had he won. [snippe] ℜ> _
A Hoopoe

In this wide expanse of utensils which number our Lines, yet another should we chronicle. The tool we have written of before, the searcher and grabber, the one called ‘grep’. But it has yet another numerological Option that may aide thee well: use the Option ‘-n’, dash en, and ‘grep’ will reveal all the matching Lines, each accompanied by its line-number. Id est:

ℜ> grep -n Carolingian access_log* 0: Lothair I, Carolingian 3: Charlemagne, Carolingian 777: Adelaide, Carolingian ℜ> _

Ctrl-D, Amen.

An Eagle Flying above Water, about 1270, Franco-Flemish
A Hoopoe, after 1277, Franco-Flemish
Digital images courtesy of the Getty’s Open Content Program

~ this page pub. 11 November 2013 ~
« previouse page: Wyld Kingdom: panthers ~ Table of Contentes ~ next page: Sponsors »