{"id":13592373,"url":"https://github.com/clarkema/x12pp","last_synced_at":"2025-04-12T20:53:23.434Z","repository":{"id":57672431,"uuid":"181778601","full_name":"clarkema/x12pp","owner":"clarkema","description":"A pretty-printer for X12 EDI files","archived":false,"fork":false,"pushed_at":"2021-06-21T16:58:13.000Z","size":29,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T20:53:19.344Z","etag":null,"topics":["edi","rust","x12"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/clarkema.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}},"created_at":"2019-04-16T22:47:11.000Z","updated_at":"2024-11-11T00:55:08.000Z","dependencies_parsed_at":"2022-08-31T02:40:19.147Z","dependency_job_id":null,"html_url":"https://github.com/clarkema/x12pp","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clarkema%2Fx12pp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clarkema%2Fx12pp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clarkema%2Fx12pp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clarkema%2Fx12pp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clarkema","download_url":"https://codeload.github.com/clarkema/x12pp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248631725,"owners_count":21136560,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["edi","rust","x12"],"created_at":"2024-08-01T16:01:08.506Z","updated_at":"2025-04-12T20:53:23.399Z","avatar_url":"https://github.com/clarkema.png","language":"Rust","funding_links":[],"categories":["CLI utilities"],"sub_categories":["Golang"],"readme":"# x12pp\n\n`x12pp` is a CLI pretty-printer for X12 EDI files.\n\nX12 is an arcane format consisting of a fixed-length header followed by a series\nof segments, each separated by a segment terminator character.\n\nThese segments are generally not separated by newlines, so extracting a range of\nlines from a file or taking a peek at the start using the usual Unix toolbox\nbecomes unnecessarily painful.\n\nOf course, you could split the lines using `sed -e 's/~/~\\n/g'` and get on with\nyour day, but:\n\n  1. although the `~` is the traditional and most widely-used segment terminator\n     it's not required -- each X12 file specifies its own terminators as part of\n    the header.\n  2. using `sed` or `perl` would mean I wouldn't have a chance to explore fast\n     stream processing in Rust.\n\nSo here we are.\n\n## Installation\n\n### Homebrew\n\n```\n$ brew tap clarkema/nomad\n$ brew install x12pp\n```\n\n### With cargo\n\n```\n$ cargo install x12pp\n```\n\n### From source\n\nx12pp is written in Rust, so you'll need an up-to-date Rust installation in\norder to build it from source.  The result is a statically-compiled binary at\n`target/release/x12pp`, which you can copy wherever you need.\n\n```\n$ git clone https://github.com/clarkema/x12pp\n$ cd x12pp\n$ cargo build --release\n$ ./target/release/x12pp --version\n```\n\n## Usage\n\n```\n$ x12pp \u003c FILE \u003e NEWFILE\n$ x12pp FILE -o NEWFILE\n\n# Strip newlines out instead with:\n$ x12pp --uglify FILE\n```\n\nSee manpage or `--help` for more.\n\n## Benchmarks\n\nAll tests were performed on an Intel Core i9-7940X, using a 1.3G X12 test file\nlocated on a RAM disk.  In each case, shell redirection was used to\npipe the file through the test command and into `/dev/null` in order to get\nas close as possible to measuring pure processing time.  For example:\n\n`$ time sed -e 's/~/~\\n/g' \u003c test-file \u003e /dev/null`\n\n| Tool        | Command                       | Terminator detection | Pre-wrapped? | SIGPIPE? | Time  |\n|-------------|-------------------------------|----------------------|--------------|----------|-------|\n| x12pp       | `x12pp`                       | ✓                    | ✓            | ✓        | 1.3s  |\n| GNU sed 4.7 | `sed -e 's/~/~\\n/g'`          | ✗                    | ✗            | ✗        | 7.6s  |\n| perl 5.28.2 | `perl -pe 's/~[\\r\\n]*/~\\n/g'` | ✗                    | ✓ but slower | ✗        | 8.5s  |\n| edicat      | `edicat`                      | ✓                    | ✓            | ✓        | 7m41s |\n\n### Notes\n\n1. 'SIGPIPE' refers to whether a command can return a partial result without\n   having to process the entire input.  One of the motivations for `x12pp` was\n   to be able to run `x12pp \u003c FILE | head -n 100` without having to plough\n   through a multi-gigabyte file.\n2. Of course you could write a Perl script that _did_ correctly read the\n   segment terminator before processing the rest of the file.\n3. Perl produces the correct output with input data that is already wrapped,\n   but _much_ slower; around 24 seconds compared to 8.5.\n4. See https://github.com/notpeter/edicat for edicat\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclarkema%2Fx12pp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclarkema%2Fx12pp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclarkema%2Fx12pp/lists"}