This Python script processes parameter lists from an input file, appends a keyword to each parameter, and splits the results into multiple output files. It utilizes multiprocessing for improved performance on multi-core systems.
- Read parameters from an input file
- Append a keyword to each parameter
- Process parameters in parallel using multiple CPU cores
- Split the results into multiple output files
- Option to remove the last character from each output chunk
- Ensure you have Python 3.6 or later installed on your system.
- Clone this repository:
git clone https://github.com/omid001php/param_spiliter.git
cd param_spiliter
- No additional dependencies are required as the script uses only Python standard libraries.
Run the script from the command line with the following syntax:
python3 main.py -u <input_file> -p <keyword> -s <split_size> [-c <cores>] [-e]
Argument | Short | Long | Required | Description |
---|---|---|---|---|
Input file | -u | --input | Yes | Path to the input text file containing parameters |
Keyword | -p | --keyword | Yes | Keyword to append to each parameter |
Split size | -s | --split | Yes | Number of parameters per output file |
CPU cores | -c | --cores | No | Number of CPU cores to use (default: 2) |
Remove end | -e | --remove_end | No | Remove the last character from each output chunk |
- Create an input file named
params.txt
with the following content:
param1
param2
param3
param4
param5
param6
You can using Fallparam, X8, Arjun
python3 main.py -u params.txt -p _keyword -s 2 -c 4 -e
- This will create output files:
params_00.txt
containing:param1_keywordparam2_keywor
params_01.txt
containing:param3_keywordparam4_keywor
params_02.txt
containing:param5_keywordparam6_keywor