Minus Numbers by 5
Minus all numbers in a text file by 5 and save to a new file.
Features
- Auto-detect delimiters: Supports comma, space, newline, tab and other separators
- Preserve original format: Automatically detect and maintain original separator format
- Flexible input: Support command line arguments or interactive input
- Error handling: Validate file existence and number format
Usage
Method 1: Command Line Arguments (Recommended)
Call skill directly with input and output file paths:
/read_file_and_minus input.txt output.txt
Parameters:
input.txt: Text file containing numbers (e.g., 1,2,3 or 1 2 3 or one number per line)
output.txt: Output file path for processed results
Method 2: Interactive Input
Call skill without parameters, then follow prompts:
/read_file_and_minus
Then enter:
- Input file path
- Output file path
Supported Delimiters
Automatically detects:
- Comma (
,) - e.g., 1,2,3,4
- Space (
) - e.g., 1 2 3 4
- Newline - one number per line
- Tab (
\t) - e.g., 1 2 3
- Multiple spaces - automatically handled
Examples
Example 1: Comma Separated
Input file content:
1,2,3,4,5
Output file content:
-4,-3,-2,-1,0
Example 2: Space Separated
Input file content:
1.5 2.3 3.7
Output file content:
-3.5 -2.7 -1.3
Example 3: Newline Separated
Input file content:
10
20
30
Output file content:
5
15
25
Example 4: Mixed Format
Input file content:
1,2 3
4,5
Output file content:
-4,-3 -2
-1,0
Output Format
Output file preserves same format as input:
- If input is single line with commas, output is single line with commas
- If input is one number per line, output is one number per line
- If input has mixed structure, output maintains same structure
Error Handling
Errors and stops on:
- Input file does not exist
- Input file is empty
- File contains non-numeric characters (letters, special symbols)
Technical Implementation
Uses Python script scripts/process_numbers.py to process file content, automatically detect delimiter type and maintain format consistency.
use command python scripts/process_numbers.py <input_file_path> <output_file_path>
1---2name: read-file-and-minus3description: Minus all numbers in a text file by 5 and save to a new file. Use when user mentions read a file minus numbers by 15, process number file, batch calculation.4---56# Minus Numbers by 578Minus all numbers in a text file by 5 and save to a new file.910## Features1112- **Auto-detect delimiters**: Supports comma, space, newline, tab and other separators13- **Preserve original format**: Automatically detect and maintain original separator format14- **Flexible input**: Support command line arguments or interactive input15- **Error handling**: Validate file existence and number format1617## Usage1819### Method 1: Command Line Arguments (Recommended)2021Call skill directly with input and output file paths:2223```24/read_file_and_minus input.txt output.txt25```2627**Parameters**:28- `input.txt`: Text file containing numbers (e.g., `1,2,3` or `1 2 3` or one number per line)29- `output.txt`: Output file path for processed results3031### Method 2: Interactive Input3233Call skill without parameters, then follow prompts:3435```36/read_file_and_minus37```3839Then enter:401. Input file path412. Output file path4243## Supported Delimiters4445Automatically detects:46- Comma (`,`) - e.g., `1,2,3,4`47- Space (` `) - e.g., `1 2 3 4`48- Newline - one number per line49- Tab (`\t`) - e.g., `1 2 3`50- Multiple spaces - automatically handled5152## Examples5354### Example 1: Comma Separated55**Input file content**:56```571,2,3,4,558```5960**Output file content**:61```62-4,-3,-2,-1,063```6465### Example 2: Space Separated66**Input file content**:67```681.5 2.3 3.769```7071**Output file content**:72```73-3.5 -2.7 -1.374```7576### Example 3: Newline Separated77**Input file content**:78```79108020813082```8384**Output file content**:85```8658715882589```9091### Example 4: Mixed Format92**Input file content**:93```941,2 3954,596```9798**Output file content**:99```100-4,-3 -2101-1,0102```103104## Output Format105106Output file preserves same format as input:107- If input is single line with commas, output is single line with commas108- If input is one number per line, output is one number per line109- If input has mixed structure, output maintains same structure110111## Error Handling112113Errors and stops on:114- Input file does not exist115- Input file is empty116- File contains non-numeric characters (letters, special symbols)117118## Technical Implementation119120Uses Python script `scripts/process_numbers.py` to process file content, automatically detect delimiter type and maintain format consistency.121use command `python scripts/process_numbers.py <input_file_path> <output_file_path>`