Skip to main content

A simple Python library to split large text files into smaller parts.

Project description

file-splitter-harsh

A Python library to efficiently split large text files into smaller chunks — perfect for preprocessing large datasets, logs, or CSV files.


Installation

Install using pip:

pip install file-splitter-harsh


## Example
from filesplitter.splitter import FileSplitter

# Initialize the splitter
splitter = FileSplitter(
    file_path="large_file.txt",     # Path to the input file
    lines_per_file=1000,            # Number of lines per output file
    output_dir="output",            # Directory to save split files
    file_prefix="chunk"             # Prefix for output file names
)

# Start splitting the file
splitter.split()

| Parameter        | Type | Default        | Description                                     |
| ---------------- | ---- | -------------- | ----------------------------------------------- |
| `file_path`      | str  | Required       | Path to the input file                          |
| `lines_per_file` | int  | `1000`         | Number of lines each output file should contain |
| `output_dir`     | str  | `"output"`     | Directory where output files will be saved      |
| `file_prefix`    | str  | `"split_part"` | Prefix to use for each generated file name      |

#Example Output
If your input file has 2500 lines and lines_per_file=1000, you'll get:
output/
├── chunk_1.txt  (1000 lines)
├── chunk_2.txt  (1000 lines)
├── chunk_3.txt  (500 lines)

Logging Example
2025-06-12 10:00:00 - INFO - File splitting complete! 3 files created in 'output'

Project details


Download files

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

Source Distribution

file_splitter_harsh-1.0.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

file_splitter_harsh-1.0.1-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file file_splitter_harsh-1.0.1.tar.gz.

File metadata

  • Download URL: file_splitter_harsh-1.0.1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for file_splitter_harsh-1.0.1.tar.gz
Algorithm Hash digest
SHA256 b954efc324f3ad522d3c4e485829001dc40a8f6c0cb22e85397498226cc97558
MD5 ae6b9dbbb9df84b94260df6d583dd5af
BLAKE2b-256 a9c339cc0aa1ddc07b3d4335f12efde638b7643685530c56c354292a27a61e23

See more details on using hashes here.

File details

Details for the file file_splitter_harsh-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for file_splitter_harsh-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f8f84d705b91c48537fb28fb680b0d01d6dcf3ffbcfe6d90ecf57201d78e9e4e
MD5 51ae8ede3f7bd837cb7f99bc02c5a5d9
BLAKE2b-256 9836fe16889d97ec8c4652a17fd1356380b7fc91844bf2e2f2b8b79e1923d081

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page