Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

a command-line script and Python module for working with text file end-of-line (EOL) characters

Project Description
`eol` is both a command-line script `eol` and a Python module `eol` for working
with end-of-line chars in text files.

This project lives here: <>

## Installation

To install in your Python's global site-packages use one of the

pip install eol
pypm install eol # if you use ActivePython (

But you use a
right? If so, then use one of the following:

pip -E path/to/env install eol
pypm -E path/to/env install eol

## Command-line examples

**List the EOL-style** of given paths:

$ eol *.txt
foo_cr.txt: Mac Classic (CR)
foo_crlf.txt: Windows (CRLF)
foo_empty.txt: No EOLs
foo_lf.txt: Unix (LF)
foo_mixed.txt: Mixed, predominantly Unix (LF)


$ eol -r ~/src/redis
/Users/trentm/src/redis/.gitignore: Unix (LF)
/Users/trentm/src/redis/BETATESTING.txt: Unix (LF)
/Users/trentm/src/redis/BUGS: Unix (LF)
/Users/trentm/src/redis/COPYING: Unix (LF)
/Users/trentm/src/redis/zmalloc.h: Unix (LF)
/Users/trentm/src/redis/.git/HEAD: Unix (LF)
/Users/trentm/src/redis/.git/config: Unix (LF)
/Users/trentm/src/redis/client-libraries/README: Unix (LF)
/Users/trentm/src/redis/design-documents/REDIS-CLUSTER: Unix (LF)
/Users/trentm/src/redis/doc/AppendOnlyFileHowto.html: Unix (LF)
/Users/trentm/src/redis/doc/AuthCommand.html: Unix (LF)

**Find files** with the given EOL-style:

$ eol -f dos -x .svn -r ~/src/python

**Convert files** to a given EOL-style:

$ eol ~/src/python/Tools/msi/
/Users/trentm/src/python/Tools/msi/ Windows (CRLF)
$ eol -c cr ~/src/python/Tools/msi/

# But who really wants CR (aka Mac Classic, '\r') EOLs.
# "native" is an alias for the EOL-style native to the current platform
$ eol -c native ~/src/python/Tools/msi/
converted `/Users/trentm/src/python/Tools/msi/' to LF EOLs
$ eol ~/src/python/Tools/msi/
/Users/trentm/src/python/Tools/msi/ Unix (LF)

## Module examples

**List the EOL-style** of given paths:

>>> import eol, glob
>>> for path in glob.glob("*.txt")
>>> for path in glob.glob("*.txt"):
... print path, eol.eol_info_from_path(path)
foo_cr.txt ('\r', '\r') # (<detected-eols>, <suggested-eols>)
foo_crlf.txt ('\r\n', '\r\n')
foo_empty.txt (None, '\n') # suggests the native EOL for empty content
foo_lf.txt ('\n', '\n')
foo_mixed.txt (<class 'eol.MIXED'>, '\n')


>>> for i in eol.eol_info_from_path_patterns(["/Users/trentm/src/redis"], recursive=True): print i
('/Users/trentm/src/redis/.gitignore', '\n', '\n')
('/Users/trentm/src/redis/BETATESTING.txt', '\n', '\n')
('/Users/trentm/src/redis/BUGS', '\n', '\n')
('/Users/trentm/src/redis/COPYING', '\n', '\n')

**Convert files** to a given EOL-style:

>>> path = "/Users/trentm/src/python/Tools/msi/"
>>> eol.eol_info_from_path(path)
('\r\n', '\r\n')
>>> eol.convert_path_eol(path, "\n")
>>> eol.eol_info_from_path(path)
('\n', '\n')
Release History

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date (25.3 kB) Copy SHA256 Checksum SHA256 Source Oct 24, 2010

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting