{"id":31725654,"url":"https://github.com/open-technology-foundation/trim","last_synced_at":"2026-04-18T19:31:45.673Z","repository":{"id":209991699,"uuid":"720938913","full_name":"Open-Technology-Foundation/trim","owner":"Open-Technology-Foundation","description":"The canonical collection of lightweight Bash utilities for managing whitespace in strings and streams.","archived":false,"fork":false,"pushed_at":"2025-12-30T02:26:52.000Z","size":114,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-02T09:20:23.199Z","etag":null,"topics":["bash","bash-functions","shell","string-manipulation","trim","whitespace-removal"],"latest_commit_sha":null,"homepage":"https://yatti.id/","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Open-Technology-Foundation.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-11-20T02:30:01.000Z","updated_at":"2025-12-30T02:26:55.000Z","dependencies_parsed_at":"2025-09-30T02:22:07.966Z","dependency_job_id":"4767ffc5-2c31-4751-9336-5592d1260b05","html_url":"https://github.com/Open-Technology-Foundation/trim","commit_stats":null,"previous_names":["open-technology-foundation/trim"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Open-Technology-Foundation/trim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-Technology-Foundation%2Ftrim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-Technology-Foundation%2Ftrim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-Technology-Foundation%2Ftrim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-Technology-Foundation%2Ftrim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Open-Technology-Foundation","download_url":"https://codeload.github.com/Open-Technology-Foundation/trim/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-Technology-Foundation%2Ftrim/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31982522,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T17:30:12.329Z","status":"ssl_error","status_checked_at":"2026-04-18T17:29:59.069Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","bash-functions","shell","string-manipulation","trim","whitespace-removal"],"created_at":"2025-10-09T05:55:06.902Z","updated_at":"2026-04-18T19:31:45.664Z","avatar_url":"https://github.com/Open-Technology-Foundation.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bash String Trim Utilities\n\n[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)\n[![Bash 4.4+](https://img.shields.io/badge/bash-4.4%2B-green.svg)](https://www.gnu.org/software/bash/)\n\n**Pure Bash string trimming utilities with zero dependencies** — Fast, portable, and battle-tested whitespace manipulation tools for shell scripts.\n\n🔗 **Repository:** [github.com/Open-Technology-Foundation/trim](https://github.com/Open-Technology-Foundation/trim)\n\n---\n\n## Table of Contents\n\n- [Quick Start](#quick-start)\n- [Why Use Trim Utilities?](#why-use-trim-utilities)\n- [Comparison with Alternatives](#comparison-with-alternatives)\n- [Overview](#overview)\n- [Utilities Reference](#utilities-reference)\n- [Installation](#installation)\n- [Basic Usage](#basic-usage)\n  - [Command-Line Usage](#command-line-usage)\n  - [Sourced Function Usage](#sourced-function-usage)\n- [Command Options](#command-options)\n- [Practical Examples](#practical-examples)\n- [How It Works](#how-it-works)\n- [Testing](#testing)\n- [Performance](#performance)\n- [Advanced Usage](#advanced-usage)\n- [Limitations \u0026 Gotchas](#limitations--gotchas)\n- [When NOT to Use](#when-not-to-use)\n- [Troubleshooting](#troubleshooting)\n- [Contributing](#contributing)\n- [License](#license)\n\n---\n\n## Quick Start\n\n```bash\n# Install (requires sudo)\ngit clone https://github.com/Open-Technology-Foundation/trim\ncd trim\nsudo make install\n\n# Basic usage\ntrim \"  hello world  \"              # Output: \"hello world\"\necho \"  text  \" | trim              # Output: \"text\"\n\n# Store result in variable (must source first)\nsource trimv\ntrimv -n result \"  hello  \"\necho \"$result\"                      # Output: \"hello\"\n\n# Normalize whitespace\ntrimall \"  multiple    spaces  \"    # Output: \"multiple spaces\"\n```\n\nSee [full documentation](#basic-usage) below.\n\n---\n\n## Why Use Trim Utilities?\n\n**Pure Bash Implementation**\n- **Zero Dependencies** — No sed, awk, tr, or other external tools required\n- **Fast** — Uses native Bash parameter expansion, no subprocess overhead\n- **Portable** — Works anywhere Bash 4.4+ is available\n\n**Flexible Architecture**\n- **Dual-Mode** — Use as command-line tools OR source as functions in scripts\n- **Pipeline-Friendly** — Full stdin/stdout support for Unix pipelines\n- **Variable Assignment** — Direct assignment with `trimv` (no subshells needed)\n\n**Production-Ready**\n- **Well-Tested** — 190+ test assertions across 20 comprehensive test suites\n- **Battle-Tested** — ~700 lines of code, proven in real-world scenarios\n- **KISS Principle** — Simple, focused utilities that do one thing well\n\n---\n\n## Comparison with Alternatives\n\n| Feature                | trim utils | sed/awk | tr      | Python |\n|------------------------|-----------|---------|---------|--------|\n| No dependencies        | ✓         | ✗       | ✗       | ✗      |\n| Pure Bash              | ✓         | ✗       | ✗       | ✗      |\n| No subprocess overhead | ✓         | ✗       | ✗       | ✗      |\n| Sourceable functions   | ✓         | ✗       | ✗       | ✗      |\n| Direct variable assign | ✓         | ✗       | ✗       | ✗      |\n| Pipeline integration   | ✓         | ✓       | ✓       | ✓      |\n\n**When to use sed/awk instead:**\n- Complex pattern matching and substitution\n- Multi-line transformations\n- CSV/TSV parsing with field manipulation\n- When already using them in your script\n\n---\n\n## Overview\n\nThese utilities provide efficient text trimming operations using pure Bash parameter expansion, without external dependencies like sed or awk. Each utility works both as a standalone command-line tool and as a sourceable function in Bash scripts.\n\n**Project Stats:**\n- 6 utilities (~750 total lines of code)\n- Pure Bash implementation (Bash 4.4+)\n- 20 test suites with 190+ assertions\n- Comprehensive Unicode support (preserves multi-byte characters)\n\n---\n\n## Utilities Reference\n\n### Basic Trimming\n\n| Utility | Description | Best For |\n|---------|-------------|----------|\n| **trim** | Removes both leading and trailing whitespace | General-purpose cleaning, config values |\n| **ltrim** | Removes only leading whitespace | Indentation removal, left-aligned text |\n| **rtrim** | Removes only trailing whitespace | Line ending cleanup, log processing |\n\n### Advanced Operations\n\n| Utility | Description | Best For |\n|---------|-------------|----------|\n| **trimv** | Trims and assigns result to a variable | Script variables, avoiding subshells |\n| **trimall** | Normalizes whitespace (trims + collapses internal spaces) | Data normalization, comparison |\n| **squeeze** | Squeezes consecutive blanks to single spaces (preserves leading/trailing) | Formatting, aligning output |\n\n---\n\n## Installation\n\n### Using Make\n\n```bash\ngit clone https://github.com/Open-Technology-Foundation/trim\ncd trim\nsudo make install\n```\n\nThis creates:\n- Extensionless commands in `/usr/local/bin/` (trim, ltrim, rtrim, trimv, trimall, squeeze)\n- Combined module file `/usr/local/share/yatti/trim/trim.inc.sh` (source all at once)\n- Manpage accessible via `man trim` (symlinked for all 6 utilities)\n\n**One-liner:**\n\n```bash\ngit clone https://github.com/Open-Technology-Foundation/trim /tmp/trim \u0026\u0026 sudo make -C /tmp/trim install \u0026\u0026 rm -rf /tmp/trim\n```\n\n**Uninstall:**\n\n```bash\nsudo make uninstall\n```\n\n**Verify Installation:**\n\n```bash\ntrim --version          # Should show: trim 1.0.0\nwhich trim              # Should show: /usr/local/bin/trim\nfile /usr/local/bin/trim  # Should show: regular file, not symlink\n```\n\n**Other targets:**\n\n```bash\nmake test               # Run test suite\nmake lint               # Run shellcheck\nmake help               # Show available targets and variables\n```\n\n---\n\n## Basic Usage\n\n### Command-Line Usage\n\nOnce installed, use utilities directly from the command line:\n\n```bash\n# Basic string trimming\ntrim \"  hello world  \"              # Output: \"hello world\"\nltrim \"  hello world  \"             # Output: \"hello world  \"\nrtrim \"  hello world  \"             # Output: \"  hello world\"\n\n# Process files\ntrim \u003c input.txt \u003e clean.txt\ncat messy.log | ltrim \u003e aligned.log\n\n# In pipelines\ngrep \"pattern\" file.txt | trim | sort | uniq\n\n# Normalize whitespace\ntrimall \"  multiple    spaces   here  \"    # Output: \"multiple spaces here\"\n\n# Squeeze consecutive spaces (preserves leading/trailing)\nsqueeze \"  hello    world  \"               # Output: \" hello world \"\n\n# Process escape sequences\ntrim -e \"  \\t hello \\n world \\t  \"         # Interprets \\t and \\n\n```\n\n### Sourced Function Usage\n\nSource utilities to use as functions in your scripts:\n\n```bash\n#!/bin/bash\n\n# Source individual utilities\nsource trim\nsource trimv\n\n# Or source all utilities at once\nsource /usr/local/share/yatti/trim/trim.inc.sh\n\n# Use as functions\nconfig_value=$(grep \"api_key:\" config.yml | cut -d':' -f2 | trim)\n\n# Direct variable assignment with trimv (no subshell)\ntrimv -n result \"  user input  \"\necho \"Cleaned: $result\"\n\n# Process data in loops\nwhile IFS= read -r line; do\n  cleaned=$(trim \"$line\")\n  echo \"Processing: $cleaned\"\ndone \u003c data.txt\n```\n\n---\n\n## Command Options\n\n| Utility | Options | Description |\n|---------|---------|-------------|\n| **trim** | `-e` | Process escape sequences (`\\t`, `\\n`, etc.) in the input |\n| | `--` | End of options (pass remaining args as input) |\n| | `-h, --help` | Display help message |\n| | `-V, --version` | Display version information |\n| **ltrim** | `-e` | Process escape sequences in the input |\n| | `--` | End of options |\n| | `-h, --help` | Display help message |\n| | `-V, --version` | Display version information |\n| **rtrim** | `-e` | Process escape sequences in the input |\n| | `--` | End of options |\n| | `-h, --help` | Display help message |\n| | `-V, --version` | Display version information |\n| **trimv** | `-e` | Process escape sequences |\n| | `-n varname` | Variable name to store result (defaults to `TRIM`) |\n| | `--` | End of options |\n| | `-h, --help` | Display help message |\n| | `-V, --version` | Display version information |\n| **trimall** | `-e` | Process escape sequences |\n| | `--` | End of options |\n| | `-h, --help` | Display help message |\n| | `-V, --version` | Display version information |\n| **squeeze** | `-e` | Process escape sequences in the input |\n| | `--` | End of options |\n| | `-h, --help` | Display help message |\n| | `-V, --version` | Display version information |\n\n**Note:** Get detailed help for any utility with: `trim --help`, `ltrim --help`, etc.\n\n---\n\n## Practical Examples\n\n### Quick Wins\n\n```bash\n# Clean configuration values\nAPI_KEY=$(grep \"api_key:\" config.yml | cut -d':' -f2 | trim)\n\n# Normalize command output\ndisk_usage=$(df -h | grep \"/$\" | awk '{print $5}' | trim)\n\n# Clean user input\nread -r user_input\nclean_input=$(trim \"$user_input\")\n\n# Remove indentation from heredocs\nSQL_QUERY=$(cat \u003c\u003cEOF | trimall\n    SELECT user_id, name\n    FROM users\n    WHERE active = 1\nEOF\n)\n```\n\n### Script Integration\n\n```bash\n#!/bin/bash\nsource /usr/local/share/yatti/trim/trim.inc.sh  # All at once\n\n# Parse CSV with proper field trimming\nwhile IFS=, read -r id name email; do\n  trimv -n ID \"$id\"\n  trimv -n NAME \"$name\"\n  trimv -n EMAIL \"$email\"\n  echo \"User: $ID -\u003e $NAME ($EMAIL)\"\ndone \u003c users.csv\n\n# Clean log file entries\nprocess_logs() {\n  while IFS= read -r line; do\n    # Remove timestamp, trim, filter\n    message=$(echo \"$line\" | sed 's/^\\[.*\\] //' | trim)\n    [[ -n \"$message\" ]] \u0026\u0026 echo \"$message\"\n  done \u003c \"$1\"\n}\n```\n\n### Pipeline Usage\n\n```bash\n# Multi-stage data cleaning\ncat raw_data.txt | trim | squeeze | sort | uniq \u003e clean_data.txt\n\n# Verify configuration files\nverify_config() {\n  grep -E \"^[^#]\" \"$1\" | while IFS= read -r line; do\n    key=$(echo \"$line\" | cut -d'=' -f1 | rtrim)\n    value=$(echo \"$line\" | cut -d'=' -f2- | ltrim)\n    echo \"Config: '$key' = '$value'\"\n  done\n}\n\n# Compare normalized file contents\nif [[ \"$(trimall \u003c file1.txt)\" == \"$(trimall \u003c file2.txt)\" ]]; then\n  echo \"Files match when normalized\"\nfi\n```\n\n### Advanced Variable Management\n\n```bash\nsource trimv\n\n# Clean API responses (avoids nested subshells)\ntrimv -n api_response \"$(curl -s https://api.example.com/status)\"\n\n# Process multiline strings\ntrimv -n clean_query \"\n    SELECT *\n    FROM users\n    WHERE status = 'active'\n\"\n\n# Handle escape sequences\ntrimv -e -n path_value \"$PATH_WITH_ESCAPES\"\n```\n\n---\n\n## How It Works\n\n### Core Trimming Technique\n\nThe utilities use Bash's native parameter expansion with the `[:blank:]` character class for efficient, dependency-free trimming:\n\n```bash\n# Leading whitespace removal\n${string#\"${string%%[![:blank:]]*}\"}\n\n# Trailing whitespace removal\n${string%\"${string##*[![:blank:]]}\"}\n```\n\n**What is `[:blank:]`?**\n- POSIX character class matching space (` `) and tab (`\\t`)\n- Does NOT match other Unicode whitespace (U+00A0, U+2000-U+200A, etc.)\n- Perfect for standard text processing tasks\n\n### Dual-Mode Architecture\n\nEach utility detects whether it's being executed or sourced:\n\n```bash\nif [[ \"${BASH_SOURCE[0]}\" == \"${0}\" ]]; then\n  # Command mode: parse args, handle --help, process input\n  [process arguments and stdin]\nelse\n  # Function mode: just define and export function\n  return 0\nfi\n```\n\nThis allows the same file to work as both a command and a sourceable function.\n\n### Performance\n\n- **Pure Bash** — No external process spawning (sed, awk, etc.)\n- **Native parameter expansion** — Compiled into shell internals\n- **Single pass** — Process each line once\n- **Minimal memory** — Stream processing, no full-file buffering\n\n---\n\n## Testing\n\nThe project includes a comprehensive test suite with extensive coverage:\n\n**Test Statistics:**\n- **20 test suites** (15 unit + 3 integration + 1 security + 1 stress)\n- **190+ test assertions**\n- **100% utility coverage**\n\n**Test Categories:**\n- **Unit tests** — Individual utility functionality, error handling, escape sequences\n- **Integration tests** — Pipelines, sourced functions, complex multi-stage workflows\n- **Unicode \u0026 encoding** — Emoji, RTL text, combining characters, binary safety, line endings\n- **Security tests** — Command injection prevention, variable name validation\n- **Stress tests** — Large inputs (100K+ chars), high line counts (10K+ lines)\n\n**Running Tests:**\n\n```bash\n# Run all tests\n./test/run-tests.sh\n\n# Run only unit tests\n./test/run-tests.sh unit\n\n# Run only integration tests\n./test/run-tests.sh integration\n\n# Run a specific test\n./test/unit/test-trim.sh\n./test/unit/test-error-handling.sh\n```\n\n**Test Output:**\n```\nRunning unit tests...\n✓ test-binary-safety passed\n✓ test-concurrent passed\n✓ test-error-handling passed\n✓ test-line-endings passed\n✓ test-locale passed\n✓ test-ltrim passed\n✓ test-null-byte passed\n✓ test-rtrim passed\n✓ test-sigpipe passed\n✓ test-squeeze passed\n✓ test-trimall passed\n✓ test-trim passed\n✓ test-trimv-advanced passed\n✓ test-trimv passed\n✓ test-unicode passed\n\nRunning integration tests...\n✓ test-complex-pipelines passed\n✓ test-pipes passed\n✓ test-sourced passed\n\nRunning security tests...\n✓ test-injection passed\n\nRunning stress tests...\n✓ test-large-inputs passed\n\nTest Summary:\nTotal tests: 20\nPassed: 20\nAll tests passed!\n```\n\nSee [test/README.md](test/README.md) for detailed test documentation.\n\n---\n\n## Performance\n\n### Benchmarks\n\nPure Bash parameter expansion is significantly faster than spawning external processes:\n\n```bash\n# trim (pure Bash) — ~0.001s per call\ntime trim \"  hello world  \"\n\n# sed equivalent — ~0.01s per call (10x slower)\ntime echo \"  hello world  \" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'\n\n# For 10,000 iterations, the difference is substantial\n```\n\n### Best Practices\n\n**For Maximum Performance:**\n- Source utilities when calling repeatedly in loops (avoids script execution overhead)\n- Use `trimv` for direct variable assignment (avoids subshell spawning)\n- Process streams line-by-line rather than reading entire files into memory\n\n**When Processing Large Files:**\n- Utilities stream process (no full-file buffering)\n- Performance is linear with file size\n- Consider GNU parallel for multi-core processing of massive datasets\n\n---\n\n## Advanced Usage\n\n### Loading All Utilities at Once\n\n```bash\n# Source the combined module file\nsource /usr/local/share/yatti/trim/trim.inc.sh  # All at once\n\n# Now all utilities are available as functions\nresult1=$(trim \"  text  \")\nresult2=$(ltrim \"  text  \")\ntrimv -n result3 \"  text  \"\n```\n\n### Custom Trim Functions\n\nBuild on the utilities for specialized needs:\n\n```bash\nsource trim\n\n# Trim and convert to lowercase\ntrimlower() {\n  local result\n  result=$(trim \"$1\")\n  echo \"${result,,}\"\n}\n\n# Trim and validate non-empty\ntrim_required() {\n  local result\n  result=$(trim \"$1\")\n  if [[ -z \"$result\" ]]; then\n    echo \"Error: Required value is empty\" \u003e\u00262\n    return 1\n  fi\n  echo \"$result\"\n}\n```\n\n### Error Handling Patterns\n\n```bash\n# Check if utility is available\nif ! command -v trim \u0026\u003e/dev/null; then\n  echo \"Error: trim utility not installed\" \u003e\u00262\n  exit 1\nfi\n\n# Handle errors with trimv\nsource trimv\nif ! trimv -n result \"  $user_input  \"; then\n  echo \"Error: Failed to trim input\" \u003e\u00262\n  exit 1\nfi\n\n# Validate variable names\nif ! trimv -n \"123invalid\" \"test\" 2\u003e/dev/null; then\n  echo \"Invalid variable name rejected (expected)\"\nfi\n```\n\n---\n\n## Limitations \u0026 Gotchas\n\n### Bash Version Requirement\n\n- **Requires Bash 4.4+** — Uses `${parameter@Q}`, `inherit_errexit`, and other features not available in older Bash or POSIX sh\n- Check version: `bash --version`\n\n### Whitespace Handling\n\n**Important:** These utilities use `[:blank:]` which only matches:\n- Space (` `, U+0020)\n- Tab (`\\t`, U+0009)\n\n**NOT trimmed:**\n- Non-breaking space (U+00A0)\n- Unicode whitespace (U+2000-U+200A, U+202F, U+205F, U+3000)\n- Zero-width space (U+200B)\n- Other Unicode separators\n\nThis is **intentional** for standard text processing. If you need Unicode whitespace handling, consider other tools.\n\n### trimv Sourcing Requirement\n\n**`trimv` must be sourced, not executed:**\n\n```bash\n# ✗ WRONG — Variable won't be set in parent shell\n./trimv.bash -n result \"  text  \"\necho \"$result\"  # Empty!\n\n# ✓ CORRECT — Source first\nsource ./trimv.bash\ntrimv -n result \"  text  \"\necho \"$result\"  # Works!\n```\n\n**Why?** Subprocesses cannot modify parent shell variables. This is a fundamental Unix/shell limitation.\n\n### Binary Data\n\n- These utilities process **text**, not binary data\n- Bash's `read` command interprets input as text\n- Null bytes (`\\0`) and other binary content may cause unexpected behavior\n- For binary processing, use specialized tools (xxd, hexdump, etc.)\n\n### Line Endings\n\n- Utilities preserve line endings as-is\n- Windows CRLF (`\\r\\n`) — `\\r` is NOT trimmed by `[:blank:]`\n- Use `dos2unix` or `sed` for line ending conversion if needed\n\n---\n\n## When NOT to Use\n\nThese utilities are excellent for most shell scripting needs, but consider alternatives when:\n\n### File Size Concerns\n\n- **Very large files (GB+)** — Consider streaming tools optimized for massive datasets\n- **Memory-constrained environments** — While efficient, massive files still consume resources\n\n### Unicode Whitespace Requirements\n\n- If you need to trim Unicode whitespace (U+00A0, U+2000-U+200A, etc.)\n- Consider: `sed`, `perl`, `python` with Unicode support\n\n### POSIX Compatibility Required\n\n- These utilities require **Bash 4.4+**\n- For POSIX sh compatibility, use traditional `sed`/`awk`\n\n### Complex Text Processing\n\n- Multi-line regex patterns\n- Field extraction with complex delimiters\n- CSV parsing with quoted fields\n- Consider: `awk`, `perl`, `python`\n\n### Binary Data Processing\n\n- Not suitable for binary files\n- Use: `xxd`, `hexdump`, `od`, or language-specific binary tools\n\n---\n\n## Troubleshooting\n\n### Command Not Found\n\n**Problem:** `bash: trim: command not found`\n\n**Solutions:**\n```bash\n# Check if installed\nwhich trim\n\n# Check installation path\nls -la /usr/local/bin/trim\n\n# Reinstall if needed\nsudo make install\n\n# Or source it\nsource trim\ntrim \"  text  \"\n```\n\n### trimv Variable Not Set\n\n**Problem:** Variable remains empty after `trimv -n varname \"text\"`\n\n**Solution:** You must **source** trimv first:\n```bash\n# Source the utility\nsource trimv\n\n# Now it works\ntrimv -n result \"  hello  \"\necho \"$result\"\n```\n\n### Unexpected Unicode Behavior\n\n**Problem:** Non-breaking spaces or other Unicode whitespace not trimmed\n\n**Explanation:** By design, utilities only trim `[:blank:]` (space + tab), not all Unicode whitespace.\n\n**Solution:** If you need Unicode whitespace handling:\n```bash\n# Use sed with extended Unicode support\necho \"  text  \" | sed 's/^[\\s\\u00A0\\u2000-\\u200A]*//;s/[\\s\\u00A0\\u2000-\\u200A]*$//'\n\n# Or Python\npython3 -c \"import sys; print(sys.stdin.read().strip())\" \u003c\u003c\u003c \"  text  \"\n```\n\n### Performance Issues with Large Files\n\n**Problem:** Slow processing of massive files\n\n**Solutions:**\n```bash\n# 1. Use GNU parallel for multi-core processing\nparallel --pipe -N 1000 trim \u003c huge_file.txt \u003e output.txt\n\n# 2. Process in chunks\nsplit -l 100000 huge_file.txt chunk_\nfor chunk in chunk_*; do\n  trim \u003c \"$chunk\" \u003e \"clean_$chunk\" \u0026\ndone\nwait\n\n# 3. Consider specialized tools\n# For GB+ files, use awk or sed which may have optimizations\n```\n\n### Permission Denied\n\n**Problem:** Permission denied during install\n\n**Solutions:**\n```bash\n# Use sudo for system-wide installation\nsudo make install\n```\n\n---\n\n## Contributing\n\nWe welcome contributions! Here's how to get involved:\n\n### Reporting Issues\n\nFound a bug or have a feature request?\n- Open an issue: [github.com/Open-Technology-Foundation/trim/issues](https://github.com/Open-Technology-Foundation/trim/issues)\n- Include: Bash version, OS, steps to reproduce, expected vs actual behavior\n\n### Pull Requests\n\n1. Fork the repository\n2. Create a feature branch: `git checkout -b feature/your-feature`\n3. **Write tests** for new functionality (required)\n4. Ensure all tests pass: `./test/run-tests.sh`\n5. Follow existing code style (see code comments)\n6. Commit with clear messages\n7. Submit pull request with description of changes\n\n### Development Setup\n\n```bash\n# Clone repository\ngit clone https://github.com/Open-Technology-Foundation/trim\ncd trim\n\n# Test your changes\n./test/run-tests.sh\n\n# Test individual utilities locally\n./trim.bash \"  test  \"\nsource ./trimv.bash \u0026\u0026 trimv -n RESULT \"  test  \" \u0026\u0026 echo \"$RESULT\"\n```\n\n### Code Standards\n\n- Follow existing patterns (dual-mode, parameter expansion)\n- Add comprehensive tests for new features\n- Update help text and documentation\n- Ensure shellcheck passes (if available)\n\n---\n\n## License\n\nGNU General Public License v3.0\n\nThis program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\n\nSee the [LICENSE](LICENSE) file for details.\n\n---\n\n## Links \u0026 Resources\n\n- **Repository:** [github.com/Open-Technology-Foundation/trim](https://github.com/Open-Technology-Foundation/trim)\n- **Issues:** [github.com/Open-Technology-Foundation/trim/issues](https://github.com/Open-Technology-Foundation/trim/issues)\n- **Latest Release:** [github.com/Open-Technology-Foundation/trim/releases](https://github.com/Open-Technology-Foundation/trim/releases)\n\n---\n\n**Made with 💙 by the Open Technology Foundation**\n\n#fin\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopen-technology-foundation%2Ftrim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopen-technology-foundation%2Ftrim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopen-technology-foundation%2Ftrim/lists"}