Sunday, April 27, 2014

head

  •   head command example

Output the first part of files, prints the first part (10 lines by default) of each file.

SYNTAX
      head [options]... [file]...


Examples

Extract the first 85 lines from a file:


$ head -5 file.txt

this is test1.
this is test2.
this is test3.
this is test4.
this is test5.


Extract lines 40-50 from a file, first using head to get the first 50 lines then tail to get the last 10:

$ head -50 file.txt | tail -10





0 comments:

Post a Comment