Convert line ending between DOS, Mac (pre OS X) and Unix
Where:
DOS = ‘\r\n’
Mac = ‘\r’ (OS9)
Unix = ‘\n’
Note: Mac here is OS9 and earlier. OS X line endings are Unix.
Examples
Convert From Unix To DOS Line Endings
$ x2y -f unx -t dos file.txt
The above command will convert Unix line ending to DOS line endings. The result is written back in to the source file.
If you want to write to another file use the -o or -d options (see below).
$ x2y -o output.txt -f unx -t dos file.txt
Will write the converted file to output.txt
$ x2y -d outputs -f unx -t dos file.txt
Will save converted files to the outputs directory.
To back up the source file use the -b option. For example:
$ x2y -b bak -f unx -t dos file.txt
Will rename the source file with a “.bak” extensions before writing the converted file.
Installation
pip install x2y
Usage
usage: x2y [options] --from line-ending --to line-ending File [File ...]
x2y: convert line ending between DOS, Mac (pre OS X) and Unix
positional arguments:
File Files to convert
optional arguments:
-h, --help show this help message and exit
--version show program's version number and exit
--debug Turn on debug logging.
--debug-log FILE Save debug logging to FILE.
-b BACKUP EXTENTSION, --backup BACKUP EXTENTSION
Save a backup of the input file by renaming with
BACKUP EXTENTSION. Ignored if the -o option is given.
Default: None.
-d DIRECTORY, --directory DIRECTORY
Save extracted text to DIRECTORY. Ignored if the -o
option is given.
-f {dos,mac,unx}, --from {dos,mac,unx}
Line ending to convert from.
-o FILE, --output FILE
Save extracted text to FILE. If not given, the output
file is named the same as the input file but with a
txt extension. The extension can be changed with the
-e option. Files are opened in append mode unless the
-X option is given.
-t {dos,mac,unx}, --to {dos,mac,unx}
Line ending to convert to.
-A, --suppress-file-access-errors
Do not print file/directory access errors.
Metadata
Release files for x2y 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| x2y-0.1.0.tar.gz | 9.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| x2y-0.1.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 17.6 kB
Release files / x2y-0.1.0.tar.gz
| Download URL | x2y-0.1.0.tar.gz |
|---|---|
| Size | 9.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1dff349d608d18fa7532a92b13a831cf159fa00cfc891f74ece6cb94cab5fcbd
|
|
BLAKE2b-256 checksum How to use checksums |
da11503478d692063a6dfe38458584f4e524d2fef3e1275a05ad328ffe1015c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / x2y-0.1.0-py2.py3-none-any.whl
| Download URL | x2y-0.1.0-py2.py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
65966d93d4b79f1e10fc085760ae7fe19a9772ab5ad7862f7c11c7779ef8561a
|
|
BLAKE2b-256 checksum How to use checksums |
d96819a4ee9688f6e9f431b9a3d1d9ed45750eb5c6e46a6745cddcecd968f2e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for x2y 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.