======
Tailer
======
.. image:: https://travis-ci.org/six8/pytailer.svg
:target: https://travis-ci.org/six8/pytailer
:alt: Build Status
Python tail is a simple implementation of GNU tail and head.
It provides 3 main functions that can be performed on any file-like object that supports ``seek()`` and ``tell()``.
* ``tail`` - read lines from the end of a file
* ``head`` - read lines from the top of a file
* ``follow`` - read lines as a file grows
It also comes with ``pytail``, a command line version offering the same functionality as GNU tail. This can be particularly useful on Windows systems that have no tail equivalent.
- `Tailer on GitHub <http://github.com/six8/pytailer>`_
- `Tailer on Pypi <http://pypi.python.org/pypi/tailer>`_
Installation
============
Install with ``pip`` or ``easy_install``.
::
pip install tailer
Examples
========
::
import tailer
f = open('test.txt', 'w')
for i in range(11):
f.write('Line %d\\n' % (i + 1))
f.close()
Tail
----
::
# Get the last 3 lines of the file
tailer.tail(open('test.txt'), 3)
# ['Line 9', 'Line 10', 'Line 11']
Head
----
::
# Get the first 3 lines of the file
tailer.head(open('test.txt'), 3)
# ['Line 1', 'Line 2', 'Line 3']
Follow
------
::
# Follow the file as it grows
for line in tailer.follow(open('test.txt')):
print line
Running Tests
=============
Tailer currently only has doctests.
Run tests with nose::
nosetests --with-doctest src/tailer
Run tests with doctest::
python -m doctest -v src/tailer/__init__.py
Raw data
{
"_id": null,
"home_page": "http://github.com/six8/pytailer",
"name": "tailer",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "tail,head",
"author": "Mike Thornton",
"author_email": "six8@devdetails.com",
"download_url": "https://files.pythonhosted.org/packages/dd/05/01de24d6393d6da0c27857c76b0f9ae97b42cd6102bbdf76cce95e031295/tailer-0.4.1.tar.gz",
"platform": "UNKNOWN",
"description": "======\nTailer\n======\n\n.. image:: https://travis-ci.org/six8/pytailer.svg\n :target: https://travis-ci.org/six8/pytailer\n :alt: Build Status\n\nPython tail is a simple implementation of GNU tail and head.\n\nIt provides 3 main functions that can be performed on any file-like object that supports ``seek()`` and ``tell()``.\n\n* ``tail`` - read lines from the end of a file\n* ``head`` - read lines from the top of a file\n* ``follow`` - read lines as a file grows\n\nIt also comes with ``pytail``, a command line version offering the same functionality as GNU tail. This can be particularly useful on Windows systems that have no tail equivalent.\n\n- `Tailer on GitHub <http://github.com/six8/pytailer>`_\n- `Tailer on Pypi <http://pypi.python.org/pypi/tailer>`_\n\nInstallation\n============\n\nInstall with ``pip`` or ``easy_install``.\n\n::\n\n pip install tailer\n\nExamples\n========\n\n::\n\n import tailer\n f = open('test.txt', 'w')\n for i in range(11):\n f.write('Line %d\\\\n' % (i + 1))\n f.close()\n\nTail\n----\n::\n\n # Get the last 3 lines of the file\n tailer.tail(open('test.txt'), 3)\n # ['Line 9', 'Line 10', 'Line 11']\n\nHead\n----\n::\n\n # Get the first 3 lines of the file\n tailer.head(open('test.txt'), 3)\n # ['Line 1', 'Line 2', 'Line 3']\n\nFollow\n------\n::\n\n # Follow the file as it grows\n for line in tailer.follow(open('test.txt')):\n print line\n\nRunning Tests\n=============\n\nTailer currently only has doctests.\n\nRun tests with nose::\n\n nosetests --with-doctest src/tailer\n\nRun tests with doctest::\n\n python -m doctest -v src/tailer/__init__.py",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python tail is a simple implementation of GNU tail and head.",
"version": "0.4.1",
"split_keywords": [
"tail",
"head"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "94de3facb2fa63d0671e1848aff4f461",
"sha256": "78d60f23a1b8a2d32f400b3c8c06b01142ac7841b75d8a1efcb33515877ba531"
},
"downloads": -1,
"filename": "tailer-0.4.1.tar.gz",
"has_sig": false,
"md5_digest": "94de3facb2fa63d0671e1848aff4f461",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7504,
"upload_time": "2015-12-09T19:44:11",
"upload_time_iso_8601": "2015-12-09T19:44:11.428574Z",
"url": "https://files.pythonhosted.org/packages/dd/05/01de24d6393d6da0c27857c76b0f9ae97b42cd6102bbdf76cce95e031295/tailer-0.4.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2015-12-09 19:44:11",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "six8",
"github_project": "pytailer",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"lcname": "tailer"
}