View the First Several Lines of a File or Files


If you don't want to see the first 10 lines of a file, you can tell head to show you a different number of lines by using the -n option followed by a number such as 5 (or --lines=5). If you specify two or more files, such as Chaucer's Canterbury Tales and Milton's Paradise Lost, the results show all the files.

$ head -n 5 Canterbury_Tales.txt Paradise_Lost.txt ==> Canterbury_Tales.txt <== Here bygynneth the Book of the Tales of Caunterbury General Prologue Whan that Aprill, with his shoures soote ==> Paradise_Lost.txt <== Book I Of Man's first disobedience, and the fruit Of that forbidden tree whose mortal taste Brought death into the World, and all our woe, 


Notice that the five lines include blank lines as well as those with text. Five lines are five lines, no matter what those lines contain.



Linux Phrasebook
Linux Phrasebook
ISBN: 0672328380
EAN: 2147483647
Year: 2007
Pages: 288

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net