{"id":47183043,"url":"https://github.com/kyotalab/xcut","last_synced_at":"2026-03-27T13:01:09.877Z","repository":{"id":296576780,"uuid":"992852801","full_name":"kyotalab/xcut","owner":"kyotalab","description":"xcut – A Flexible Field Extractor and Filter Tool for the Command Line","archived":false,"fork":false,"pushed_at":"2025-06-03T04:00:47.000Z","size":24,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-14T20:25:51.657Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kyotalab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2025-05-29T20:17:51.000Z","updated_at":"2025-09-24T06:49:58.000Z","dependencies_parsed_at":"2025-06-01T05:09:59.951Z","dependency_job_id":"694241c0-902c-4948-8352-b49e259eee20","html_url":"https://github.com/kyotalab/xcut","commit_stats":null,"previous_names":["kyotalab/xcut"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kyotalab/xcut","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyotalab%2Fxcut","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyotalab%2Fxcut/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyotalab%2Fxcut/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyotalab%2Fxcut/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kyotalab","download_url":"https://codeload.github.com/kyotalab/xcut/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyotalab%2Fxcut/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31045640,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-27T09:35:52.079Z","status":"ssl_error","status_checked_at":"2026-03-27T09:35:20.916Z","response_time":164,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":[],"created_at":"2026-03-13T08:00:38.401Z","updated_at":"2026-03-27T13:01:09.872Z","avatar_url":"https://github.com/kyotalab.png","language":"Rust","funding_links":[],"categories":["\u003ca name=\"text-processing\"\u003e\u003c/a\u003eText processing"],"sub_categories":[],"readme":"# xcut – A Flexible Field Extractor and Filter Tool for the Command Line\n\n**xcut** is an extended version of the Unix `cut` command, with support for filtering, column extraction, and flexible delimiters.\nIt is written in Rust and supports cross-platform usage (Linux, macOS, Windows via CMD or Git Bash).\n\n---\n\n## Features\n\n- Column selection (`--cols`)\n- Flexible field delimiter (`--delim`, `--max-split`)\n- Field filtering with boolean logic and regex (`--filter`)\n- Output customization (`--out-delim`, `--output`)\n- CSV-style header skipping (`--no-header`)\n- Head/tail output restriction (`--head`, `--tail`)\n- Accepts stdin when no input file is specified\n\n---\n\n## Usage\n\n```sh\nxcut [OPTIONS]\n```\n\n### Basic Options\n\n- `-i`, `--input \u003cINPUT\u003e`\n  Path to the input file. Reads from stdin if not specified\n\n- `-f`, `--filter \u003cFILTER\u003e`\n  Filter expression to match lines. Supports regex and boolean logic.\n  Examples:\n  - `col(3) == \"INFO\"`\n  - `col(4) =~ \"^CPU\"`\n  - `col(3) !~ \"DEBUG\" \u0026\u0026 col(4) =~ \"error\"`\n\n- `-c`, `--cols \u003cCOLS\u003e`\n  List of column numbers to output (1-based index).\n  Example: `--cols 1,3`\n\n- `--delim \u003cDELIM\u003e`\n  Delimiter used to split each line into columns. Default is whitespace\n\n- `--max-split \u003cN\u003e`\n  Maximum number of splits to perform when using `--delim`. Useful to preserve trailing content in the last field\n\n- `--out-delim \u003cOUT_DELIM\u003e`\n  Delimiter used to join output fields. Default is a space\n\n- `-o`, `--output \u003cOUTPUT\u003e`\n  Path to output file. Appends to the file if it exists. Defaults to stdout\n\n- `--no-header`\n  Skip the first line (e.g. header in CSV files)\n\n- `--head \u003cHEAD\u003e`\n  Output only the first N lines (like `head`)\n\n- `--tail \u003cTAIL\u003e`\n  Output only the last N lines (like `tail`)\n\n- `-h`, `--help`\n  Print help (see a summary with `-h`)\n\n- `-V`, `--version`\n  Print version\n\n---\n\n## Filtering Expression Examples\n\nYou can filter lines using column values. Examples:\n\n| Expression                              | Description                                |\n|-----------------------------------------|--------------------------------------------|\n| `col(2) == \"INFO\"`                      | Select rows where column 2 equals \"INFO\"   |\n| `col(2) != \"INFO\"`                      | Select rows where column 2 is not \"INFO\"   |\n| `col(4) =~ \"CPU\"`                       | Regex match: column 4 contains \"CPU\"       |\n| `col(3) !~ \"DEBUG\"`                     | Regex *not* match                          |\n| `col(2) == \"INFO\" \u0026\u0026 col(4) =~ \"CPU\"`   | Logical AND of two conditions              |\n| `col(2) == \"INFO\" || col(2) == \"WARN\"`  | Logical OR                                 |\n\n---\n\n## Examples\n\n```bash\n## Extract columns 2 and 4 with space as delimiter, max 4 splits\nxcut --input sample_logs.txt --cols 2,4 --delim ' ' --max-split 4\n\n# Filter lines where column 3 matches regex and output to a file\nxcut --input sample_logs.txt --filter 'col(3) =~ \"ERROR\"' --output errors.txt\n\n# Only take the first 10 lines, skip the header\nxcut --input data.csv --no-header --head 10 --cols 1,2,3 --delim ','\n\n# Use regex negation\nxcut --input logs.txt --filter 'col(3) !~ \"DEBUG\"'\n```\n\n---\n\n## PowerShell Note (Windows)\n\nPowerShell has issues interpreting `!~`, quotes, and parentheses.\nFor best results on Windows:\n\n- Use **cmd.exe** or **Git Bash**\n\n---\n\n## Running Tests\n\nTo run integration tests, make sure the binary is built first:\n\n```bash\ncargo build\ncargo test\n```\n\nThe tests expect `target/debug/xcut` to be available. If you want to run tests directly without building separately, simply use:\n\n```bash\ncargo test\n```\n\n---\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkyotalab%2Fxcut","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkyotalab%2Fxcut","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkyotalab%2Fxcut/lists"}