how to implement tail or head command ?



hello ,
I am writing a mini shell and I want to implement the tail and head
command . How it works is , it takes a file as input ,and by default
"head" will display the 1st 10 lines of the file and tail will display
the last 10 lines . Any ideas as to how to read say, some k lines from a
file ?

Thanking you,
Maadhuu.

.



Relevant Pages

  • HELP for doubly linked list
    ... forward and one pointing backwards. ... You must be able to insert a new node at the head of the ... You must be able to insert a new node at the tail of the ... tail, F – display contents forward, B – display contents backwards, ...
    (microsoft.public.dotnet.languages.vc)
  • HELP for doubly linked list
    ... forward and one pointing backwards. ... You must be able to insert a new node at the head of the ... You must be able to insert a new node at the tail of the ... tail, F – display contents forward, B – display contents backwards, ...
    (microsoft.public.dotnet.languages.vc)
  • Re: how to implement tail or head command ?
    ... >I am writing a mini shell and I want to implement the tail and head ... >"head" will display the 1st 10 lines of the file and tail will display ...
    (comp.programming)
  • Re: How to print all lines of a file starting from line number X
    ... know that with head I can display the first X and with tail the last Y. ...
    (comp.os.linux.misc)
  • Re: Python Doc Problem Example: os.path.split
    ... I was working on a program where i needed to split a path into dirname, ... > Split the pathname path into a pair, (head, tail) where tail is the ... > last pathname component and head is everything leading up to that. ... > tail part will never contain a slash; if path ends in a slash, ...
    (comp.unix.programmer)