Compare commits
98
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
58608af612 | ||
|
|
d1f49fdb8a | ||
|
|
49fc67a25e | ||
|
|
96afb29187 | ||
|
|
7db579b0b8 | ||
|
|
cccbcec479 | ||
|
|
443b085fb9 | ||
|
|
10fa717ee9 | ||
|
|
e6829c3d16 | ||
|
|
8a7fc1bed9 | ||
|
|
d43d4dea6b | ||
|
|
479c4bedf0 | ||
|
|
3676eac374 | ||
|
|
8ba5a5f440 | ||
|
|
21ffff7a8e | ||
|
|
7e46328d8a | ||
|
|
111347950e | ||
|
|
95804a298b | ||
|
|
0554c50b65 | ||
|
|
f7fb0d797e | ||
|
|
75fbaca15b | ||
|
|
e40667ffc5 | ||
|
|
dfae00da61 | ||
|
|
a05d74344e | ||
|
|
b451333205 | ||
|
|
72ed709088 | ||
|
|
7f9ce84f34 | ||
|
|
cb9135ddac | ||
|
|
76086c8d9a | ||
|
|
ab2f0a82d8 | ||
|
|
e5474abccf | ||
|
|
961835e509 | ||
|
|
4a73dfb60c | ||
|
|
a1a146a720 | ||
|
|
c46dd6dab6 | ||
|
|
fcab8f1ca7 | ||
|
|
cffecd151f | ||
|
|
0339313d49 | ||
|
|
cffcc0c806 | ||
|
|
643266bc93 | ||
|
|
81cf88e601 | ||
|
|
cc5e214878 | ||
|
|
e4a923ac98 | ||
|
|
77f442ddc2 | ||
|
|
dc2ec59ce7 | ||
|
|
08b8594355 | ||
|
|
f1c5813aa4 | ||
|
|
32537dd5d9 | ||
|
|
b038f8fb2d | ||
|
|
b39a9eaa05 | ||
|
|
7be1f77dda | ||
|
|
e858951814 | ||
|
|
a7a303352e | ||
|
|
76efad4aa1 | ||
|
|
79e5df0df8 | ||
|
|
3f72f93c5d | ||
|
|
d837ddf398 | ||
|
|
b1ca27e82d | ||
|
|
ce711ac531 | ||
|
|
618a3f7c39 | ||
|
|
079eb9340e | ||
|
|
2ce633cb8d | ||
|
|
91465e566b | ||
|
|
d842aa305e | ||
|
|
d28a1f8e73 | ||
|
|
af5f8afdcb | ||
|
|
8f3f126816 | ||
|
|
c771318a7a | ||
|
|
36a1cf4954 | ||
|
|
13bb82ba13 | ||
|
|
cb9eb1da42 | ||
|
|
b101462d1b | ||
|
|
9f2e1a1ad4 | ||
|
|
2b092d53b0 | ||
|
|
550d545d72 | ||
|
|
a5d219764f | ||
|
|
397ab86302 | ||
|
|
2288789f33 | ||
|
|
84ae1b07a7 | ||
|
|
f32296fc22 | ||
|
|
7239fb0e08 | ||
|
|
c7e1f78486 | ||
|
|
fb907703a0 | ||
|
|
3d52077d7f | ||
|
|
e9792a8ef9 | ||
|
|
c732b60cfc | ||
|
|
c1e5d8ea08 | ||
|
|
6887201cce | ||
|
|
75d856e4c2 | ||
|
|
d7a2106258 | ||
|
|
a726ac6959 | ||
|
|
49590e63be | ||
|
|
99a9957e89 | ||
|
|
c521271ca8 | ||
|
|
7830c20bc1 | ||
|
|
b37e23fa98 | ||
|
|
07eada8531 | ||
|
|
15def35a2a |
No files matched your search
@@ -49,6 +49,19 @@ jobs:
|
||||
|
||||
# Omit installing part of https://github.com/actions/runner-images/tree/main/images/ubuntu
|
||||
|
||||
### Locales
|
||||
# Several testsuite scripts guard themselves with require_*_locale_ and
|
||||
# silently skip when the locale is missing, which hides both regressions
|
||||
# and improvements in the multibyte code paths.
|
||||
- name: Generate the locales required by the testsuite
|
||||
shell: bash
|
||||
run: |
|
||||
## Generate the locales required by the testsuite
|
||||
sudo localedef -i en_US -f UTF-8 en_US.UTF-8
|
||||
sudo localedef -i ru_RU -f UTF-8 ru_RU.UTF-8
|
||||
sudo localedef -i el_GR -f ISO-8859-7 el_GR.iso88597
|
||||
locale -a
|
||||
|
||||
### Build
|
||||
- name: Build Rust sed binary
|
||||
shell: bash
|
||||
@@ -134,7 +147,7 @@ jobs:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Retrieve reference artifacts
|
||||
uses: dawidd6/action-download-artifact@v21
|
||||
uses: dawidd6/action-download-artifact@v27
|
||||
continue-on-error: true
|
||||
with:
|
||||
workflow: GnuTests.yml
|
||||
|
||||
@@ -33,7 +33,7 @@ jobs:
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
- name: Run sccache-cache
|
||||
uses: mozilla-actions/sccache-action@v0.0.10
|
||||
uses: mozilla-actions/sccache-action@v0.0.11
|
||||
|
||||
- name: Install tools
|
||||
uses: taiki-e/install-action@v2
|
||||
@@ -47,7 +47,7 @@ jobs:
|
||||
cargo codspeed build -p ${{ matrix.benchmark-target.package }}
|
||||
|
||||
- name: Run benchmarks for ${{ matrix.benchmark-target.package }}
|
||||
uses: CodSpeedHQ/action@v4
|
||||
uses: CodSpeedHQ/action@v5
|
||||
env:
|
||||
CODSPEED_LOG: debug
|
||||
with:
|
||||
|
||||
@@ -97,12 +97,12 @@ jobs:
|
||||
RUSTC_WRAPPER: ""
|
||||
RUSTFLAGS: "-Cinstrument-coverage -Zcoverage-options=branch -Ccodegen-units=1 -Copt-level=0 -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
|
||||
RUSTDOCFLAGS: "-Cpanic=abort"
|
||||
LLVM_PROFILE_FILE: "sed-%p-%m.profraw"
|
||||
LLVM_PROFILE_FILE: "${{ github.workspace }}/sed-%p-%m.profraw"
|
||||
- name: "`grcov` ~ install"
|
||||
id: build_grcov
|
||||
shell: bash
|
||||
run: |
|
||||
git clone https://github.com/mozilla/grcov.git ~/grcov/
|
||||
git clone --depth=1 https://github.com/mozilla/grcov.git ~/grcov/
|
||||
cd ~/grcov
|
||||
cargo install --path .
|
||||
cd -
|
||||
|
||||
@@ -51,7 +51,7 @@ jobs:
|
||||
components: clippy
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- name: Run sccache-cache
|
||||
uses: mozilla-actions/sccache-action@v0.0.10
|
||||
uses: mozilla-actions/sccache-action@v0.0.11
|
||||
- name: Initialize workflow variables
|
||||
id: vars
|
||||
shell: bash
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
name: Documentation
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'docs/**'
|
||||
- '.github/workflows/documentation.yml'
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'docs/**'
|
||||
- '.github/workflows/documentation.yml'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build-doc:
|
||||
name: Build the mdBook documentation
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Install mdbook
|
||||
uses: taiki-e/install-action@v2
|
||||
with:
|
||||
tool: mdbook@0.5.0
|
||||
|
||||
- name: Build documentation
|
||||
run: mdbook build docs
|
||||
|
||||
- name: Upload documentation
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: documentation
|
||||
path: docs/book
|
||||
@@ -64,7 +64,7 @@ jobs:
|
||||
# we specify bash to get pipefail; it guards against the `curl` command
|
||||
# failing. otherwise `sh` won't catch that `curl` returned non-0
|
||||
shell: bash
|
||||
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.30.3/cargo-dist-installer.sh | sh"
|
||||
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.33.0/cargo-dist-installer.sh | sh"
|
||||
- name: Cache dist
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
|
||||
Generated
+481
-943
File diff suppressed because it is too large.
Load diff
+28
-14
@@ -1,12 +1,12 @@
|
||||
# sed (uutils)
|
||||
# * see the repository LICENSE, README, and CONTRIBUTING files for more information
|
||||
|
||||
# spell-checker:ignore (libs) mangen sed
|
||||
# spell-checker:ignore (libs) mangen sed binstall codspeed libc memchr memmap rlimit rustix textwrap uucore uutests xattr
|
||||
# spell-checker:ignore (misc) clippy codegen msvc startswith uninlined uutils
|
||||
|
||||
[package]
|
||||
name = "sed"
|
||||
version = "0.1.1"
|
||||
authors = ["uutils developers"]
|
||||
version = "0.3.0"
|
||||
license = "MIT"
|
||||
description = "sed ~ implemented as universal (cross-platform) utils, written in Rust"
|
||||
default-run = "sed"
|
||||
@@ -21,6 +21,19 @@ rust-version = "1.88"
|
||||
|
||||
build = "build.rs"
|
||||
|
||||
# cargo-binstall: fetch the archives published by `dist` in the GitHub releases
|
||||
# instead of building from source. The layout below has to stay in sync with
|
||||
# `dist-workspace.toml` (targets) and the archives it produces:
|
||||
# sed-<target>.tar.xz (zip on Windows), containing a sed-<target>/ directory.
|
||||
# Note that the release tags carry no `v` prefix, hence `{ version }`.
|
||||
[package.metadata.binstall]
|
||||
pkg-url = "{ repo }/releases/download/{ version }/{ name }-{ target }.{ archive-suffix }"
|
||||
bin-dir = "{ name }-{ target }/{ bin }{ binary-ext }"
|
||||
pkg-fmt = "txz"
|
||||
|
||||
[package.metadata.binstall.overrides.x86_64-pc-windows-msvc]
|
||||
pkg-fmt = "zip"
|
||||
|
||||
[features]
|
||||
default = ["feat_common_core"]
|
||||
|
||||
@@ -29,10 +42,6 @@ sed = []
|
||||
|
||||
[workspace.dependencies]
|
||||
assert_fs = "1.1.3"
|
||||
bytesize = "2.0.0"
|
||||
chrono = { version = "0.4.37", default-features = false, features = [
|
||||
"clock",
|
||||
] }
|
||||
clap = { version = "4.4", features = ["wrap_help", "cargo"] }
|
||||
clap_complete = "4.5"
|
||||
clap_mangen = "0.3"
|
||||
@@ -47,12 +56,13 @@ phf_codegen = "0.14.0"
|
||||
predicates = "3.1.3"
|
||||
rand = { version = "0.10.0" }
|
||||
regex = "1.10.4"
|
||||
sha2 = "0.11"
|
||||
sysinfo = "0.38"
|
||||
sha2 = { version = "0.11.0", default-features = false, features = ["alloc"] }
|
||||
tempfile = "3.10.1"
|
||||
terminal_size = "0.4.2"
|
||||
textwrap = { version = "0.16.1", features = ["terminal_size"] }
|
||||
uucore = { version = "0.9.0", features = ["libc"] }
|
||||
unicode-width = "0.2.2"
|
||||
uucore = { version = "0.12.0", features = ["diagnostics", "libc"] }
|
||||
rustix = "1.1.4"
|
||||
xattr = "1.3.1"
|
||||
|
||||
|
||||
@@ -66,15 +76,15 @@ memmap2.workspace = true
|
||||
phf = { workspace = true }
|
||||
predicates = { workspace = true }
|
||||
regex = { workspace = true }
|
||||
sysinfo = { workspace = true }
|
||||
tempfile = { workspace = true }
|
||||
terminal_size = { workspace = true }
|
||||
textwrap = { workspace = true }
|
||||
unicode-width = { workspace = true }
|
||||
uucore = { workspace = true }
|
||||
rustix = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
assert_fs = { workspace = true }
|
||||
chrono = { workspace = true }
|
||||
ctor = "1.0.0"
|
||||
divan = { workspace = true }
|
||||
hex = { workspace = true }
|
||||
@@ -85,7 +95,7 @@ regex = { workspace = true }
|
||||
sha2 = { workspace = true }
|
||||
tempfile = { workspace = true }
|
||||
uucore = { workspace = true, features = ["entries", "process", "signals", "benchmark"] }
|
||||
uutests = "0.9.0"
|
||||
uutests = "0.12.0"
|
||||
|
||||
[target.'cfg(unix)'.dev-dependencies]
|
||||
xattr = { workspace = true }
|
||||
@@ -119,6 +129,10 @@ inherits = "release"
|
||||
opt-level = "z"
|
||||
strip = true
|
||||
|
||||
# The profile that 'dist' will build with
|
||||
[profile.dist]
|
||||
inherits = "release"
|
||||
|
||||
[lints.clippy]
|
||||
all = { level = "warn", priority = -1 }
|
||||
|
||||
@@ -135,7 +149,7 @@ must_use_candidate = "allow" # 56
|
||||
needless_raw_string_hashes = "allow" # 20
|
||||
needless_pass_by_value = "allow" # 15
|
||||
missing_panics_doc = "allow" # 12
|
||||
cast_possible_truncation = "allow" # 7
|
||||
# cast_possible_truncation = "allow" # 7
|
||||
unnecessary_wraps = "allow" # 6
|
||||
match_wildcard_for_single_variants = "allow" # 4
|
||||
cast_sign_loss = "allow" # 4
|
||||
|
||||
@@ -15,22 +15,30 @@ and other extensions.
|
||||
## Status
|
||||
|
||||
At this state _sed_ implements all [POSIX features](https://pubs.opengroup.org/onlinepubs/9799919799/)
|
||||
and can run correctly the two complex scripts of its integration tests:
|
||||
[hanoi.sed](https://github.com/uutils/sed/blob/main/tests/fixtures/sed/script/hanoi.sed) (solves the Towers of Hanoi puzzle) and
|
||||
and can run correctly the three complex scripts of its integration tests:
|
||||
[hanoi.sed](https://github.com/uutils/sed/blob/main/tests/fixtures/sed/script/hanoi.sed) (solves the Towers of Hanoi puzzle),
|
||||
[mandelbrot.sed](https://github.com/uutils/sed/blob/main/tests/fixtures/sed/script/mandelbrot.sed), (draws the Mandelbrot set) and
|
||||
[math.sed](https://github.com/uutils/sed/blob/main/tests/fixtures/sed/script/math.sed) (implements an arbitrary precision integer math calculator).
|
||||
|
||||
The performance of this Rust implementation is now better than the GNU and FreeBSD implementations for most benchmarked cases.
|
||||
|
||||
Further work aims to:
|
||||
* Adjust buffering on terminal output to match current implementations,
|
||||
* Implement more GNU extensions,
|
||||
* Improve performance where possible.
|
||||
* improve GNU _sed_ compatibility, especially on the regular expression front,
|
||||
* implement more GNU extensions, and
|
||||
* improve performance where possible.
|
||||
|
||||
## Installation and Use
|
||||
|
||||
We provide a Linux x86_64 binary archive from the main branch at
|
||||
https://github.com/uutils/sed/releases/tag/latest-commit .
|
||||
|
||||
If you have [cargo-binstall](https://github.com/cargo-bins/cargo-binstall),
|
||||
the released binaries can be installed directly with:
|
||||
|
||||
```bash
|
||||
cargo binstall sed
|
||||
```
|
||||
|
||||
For other platforms, ensure you have Rust installed on your system. You can install Rust through [rustup](https://rustup.rs/).
|
||||
|
||||
Clone the repository and build the project using Cargo:
|
||||
@@ -80,58 +88,8 @@ cargo test
|
||||
```
|
||||
|
||||
## Extensions and incompatibilities
|
||||
### Supported GNU extensions
|
||||
* Command-line arguments can be specified in long (`--`) form.
|
||||
* Spaces can precede a regular expression modifier.
|
||||
* `I` can be used in as a synonym for the `i` (case insensitive) substitution
|
||||
flag.
|
||||
* `M` and `m` substitution flags allow multi-line matching.
|
||||
* In addition to `\n`, other escape sequences (octal, hex, C) are supported
|
||||
in the strings of the `y` command.
|
||||
Under POSIX these yield undefined behavior.
|
||||
* The `a`, `c`, and `i` commands do not require an initial backslash,
|
||||
allow text to appear on the same line, and support escape sequences
|
||||
in the specified text.
|
||||
* The `a`, `i`, `=`, `l`, `q` and `r` commands support address range as an extension to POSIX.
|
||||
* The substitution command replacement group `\0` is a synonym for &.
|
||||
* A `Q` command (optionally followed by an exit code) quits immediately.
|
||||
* The `q` command can be optionally followed by an exit code.
|
||||
* The `l` command can be optionally followed by the output width.
|
||||
* The `--follow-symlinks` option for in-place editing.
|
||||
* The `--sandbox` option that limits potentially destructive commands.
|
||||
* Address 0 can be used to specify an address range that is already
|
||||
active on line 1 and can finish with the specified regular expression.
|
||||
* Address steps can be specified in the form of start~step and start,~step
|
||||
ranges.
|
||||
* Address 0 can be used in the `r` command to prepend a file.
|
||||
|
||||
### Supported BSD and GNU extensions
|
||||
* The second address in a range can be specified as a relative address with +N.
|
||||
* In-place editing of file with the `-i` flag.
|
||||
|
||||
### New extensions
|
||||
* Unicode characters can be specified in regular expression pattern, replacement
|
||||
and transliteration sequences using `\uXXXX` or `\UXXXXXXXX` sequences.
|
||||
* The `l` command lists Unicode characters using the `\uXXXX` and `\UXXXXXXXX`
|
||||
sequences.
|
||||
|
||||
### Incompatibilities
|
||||
* The input is assumed to be valid UTF-8 (this includes 7-bit ASCII).
|
||||
If the input is in another code page, consider converting it through UTF-8
|
||||
in order to avoid errors on invalid UTF-8 sequences and for the correct
|
||||
handling of regular expressions.
|
||||
This _sed_ program can also handle arbitrary byte sequences if no part of the
|
||||
input is treated as string.
|
||||
* The command will report an error and fail if duplicate labels are found
|
||||
in the script.
|
||||
This matches the BSD behavior. The GNU version accepts duplicate labels.
|
||||
* The last line (`$`) address is interpreted as the last non-empty line of
|
||||
the last file. If files specified in subsequent arguments until the last
|
||||
one are empty, then the last line condition will never be triggered.
|
||||
This behavior is consistent with the
|
||||
[original implementation](https://github.com/dspinellis/unix-history-repo/blob/Research-V7/usr/src/cmd/sed/sed1.c#L665).
|
||||
* Labels are parsed for alphanumeric characters. The BSD version parses them
|
||||
until the end of the line, preventing ; to be used as a separator.
|
||||
The GNU, BSD and new extensions _sed_ supports, and where it differs from GNU
|
||||
_sed_, are listed in [docs/src/extensions.md](docs/src/extensions.md).
|
||||
|
||||
## GNU test suite compatibility
|
||||
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ members = ["cargo:."]
|
||||
# Config for 'dist'
|
||||
[dist]
|
||||
# The preferred dist version to use in CI (Cargo.toml SemVer syntax)
|
||||
cargo-dist-version = "0.30.3"
|
||||
cargo-dist-version = "0.33.0"
|
||||
# CI backends to support
|
||||
ci = "github"
|
||||
# The installers to generate for each app
|
||||
@@ -13,5 +13,5 @@ installers = []
|
||||
targets = ["aarch64-apple-darwin", "aarch64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl", "x86_64-pc-windows-msvc"]
|
||||
# Which actions to run on pull requests
|
||||
pr-run-mode = "plan"
|
||||
# Allow dirty workflows to ignore out-of-date contents
|
||||
# Skip checking whether the specified configuration files are up to date
|
||||
allow-dirty = ["ci"]
|
||||
@@ -0,0 +1 @@
|
||||
book
|
||||
@@ -0,0 +1,7 @@
|
||||
[book]
|
||||
language = "en"
|
||||
src = "src"
|
||||
title = "uutils sed Documentation"
|
||||
|
||||
[output.html]
|
||||
git-repository-url = "https://github.com/uutils/sed/tree/main/docs/src"
|
||||
@@ -0,0 +1,5 @@
|
||||
# Summary
|
||||
|
||||
[Introduction](index.md)
|
||||
|
||||
* [Extensions and incompatibilities](extensions.md)
|
||||
@@ -0,0 +1,86 @@
|
||||
# Extensions and incompatibilities
|
||||
|
||||
The main goal of the project is compatibility with GNU _sed_, but _sed_ also
|
||||
supports features that GNU _sed_ does not, and differs from it in a few places.
|
||||
Below is a list of these extensions and incompatibilities.
|
||||
|
||||
## Supported GNU extensions
|
||||
* Command-line arguments can be specified in long (`--`) form.
|
||||
* Spaces can precede a regular expression modifier.
|
||||
* `I` can be used in as a synonym for the `i` (case insensitive) substitution
|
||||
flag.
|
||||
* `M` and `m` substitution flags allow multi-line matching.
|
||||
* In addition to `\n`, other escape sequences (octal, hex, C) are supported
|
||||
in the strings of the `y` command.
|
||||
Under POSIX these yield undefined behavior.
|
||||
* The `a`, `c`, and `i` commands do not require an initial backslash,
|
||||
allow text to appear on the same line, and support escape sequences
|
||||
in the specified text.
|
||||
* The `a`, `i`, `=`, `l`, `q` and `r` commands support address range as an extension to POSIX.
|
||||
* The substitution command replacement group `\0` is a synonym for &.
|
||||
* An `F` command outputs the name of the file currently being processed.
|
||||
* A `Q` command (optionally followed by an exit code) quits immediately.
|
||||
* The `q` command can be optionally followed by an exit code.
|
||||
* A `W` command writes to a file the pattern's first line.
|
||||
* An `R` command reads one line at a time from a file.
|
||||
* The `l` command can be optionally followed by the output width.
|
||||
* The `--follow-symlinks` option for in-place editing.
|
||||
* The `--sandbox` option that limits potentially destructive commands.
|
||||
* Address 0 can be used to specify an address range that is already
|
||||
active on line 1 and can finish with the specified regular expression.
|
||||
* Address steps can be specified in the form of start~step and start,~step
|
||||
ranges.
|
||||
* Address 0 can be used in the `r` command to prepend a file.
|
||||
|
||||
## Supported BSD and GNU extensions
|
||||
* The second address in a range can be specified as a relative address with +N.
|
||||
* In-place editing of file with the `-i` flag.
|
||||
As in GNU _sed_, a backup suffix must be attached (`-i.bak`,
|
||||
`--in-place=.bak`); BSD's `-i .bak` and `-i ''` are not supported.
|
||||
|
||||
## New extensions
|
||||
* Unicode characters can be specified in regular expression pattern, replacement
|
||||
and transliteration sequences using `\uXXXX` or `\UXXXXXXXX` sequences.
|
||||
* On a terminal, script errors also quote the script line and underline the
|
||||
character at fault (`UUTILS_DIAG=always` or `never` overrides this):
|
||||
```
|
||||
$ sed 's/a/b/q'
|
||||
sed: <script argument 1>:1:7: error: invalid substitute flag: 'q'
|
||||
╭─[ <script argument 1>:1:7 ]
|
||||
│
|
||||
1 │ s/a/b/q
|
||||
│ ─
|
||||
───╯
|
||||
```
|
||||
|
||||
## Incompatible extensions
|
||||
The `-U` or `--uutil-extensions` option enables useful extensions or bug fixes
|
||||
that aren't compatible with GNU sed or POSIX.
|
||||
|
||||
* The `l` command lists Unicode characters using the `\uXXXX` and `\UXXXXXXXX`
|
||||
escapes rather than as octal UTF-8 byte sequences.
|
||||
|
||||
## Incompatibilities
|
||||
* Similarly to GNU _sed_, input is processed as raw bytes or as valid UTF-8
|
||||
(this includes 7-bit ASCII) based on the locale as specified by the
|
||||
`LC_ALL`, `LC_CTYPE`, and `LANG` environment variables,
|
||||
with the default being byte processing.
|
||||
However, in contrast with GNU _sed_, other locales (e.g. ISO-8859-1)
|
||||
are not supported. If the input is in another code page or encoding
|
||||
and requires locale-specific processing (e.g. ignore/map case,
|
||||
character classes), consider converting it through UTF-8 to ensure
|
||||
the correct handling of locale-specific regular expressions.
|
||||
This _sed_ program can also handle arbitrary byte sequences
|
||||
if no part of the input requires treating it as a Rust String.
|
||||
* Back-references aren't supported when input is processed as bytes
|
||||
(`LC_ALL=C`).
|
||||
* The command will report an error and fail if duplicate labels are found
|
||||
in the script.
|
||||
This matches the BSD behavior. The GNU version accepts duplicate labels.
|
||||
* The last line (`$`) address is interpreted as the last non-empty line of
|
||||
the last file. If files specified in subsequent arguments until the last
|
||||
one are empty, then the last line condition will never be triggered.
|
||||
This behavior is consistent with the
|
||||
[original implementation](https://github.com/dspinellis/unix-history-repo/blob/Research-V7/usr/src/cmd/sed/sed1.c#L665).
|
||||
* Labels are parsed for alphanumeric characters. The BSD version parses them
|
||||
until the end of the line, preventing ; to be used as a separator.
|
||||
@@ -0,0 +1,10 @@
|
||||
# uutils sed
|
||||
|
||||
_sed_ is a Rust reimplementation of the
|
||||
[sed utility](https://pubs.opengroup.org/onlinepubs/9799919799/utilities/sed.html)
|
||||
with some [GNU sed](https://www.gnu.org/software/sed/manual/sed.html),
|
||||
[FreeBSD sed](https://man.freebsd.org/cgi/man.cgi?sed(1)),
|
||||
and other extensions.
|
||||
|
||||
It is part of the [uutils](https://uutils.github.io/) project. The source code
|
||||
is on [GitHub](https://github.com/uutils/sed).
|
||||
Generated
+400
-530
File diff suppressed because it is too large.
Load diff
+2
-2
@@ -14,8 +14,8 @@ libc = "0.2.153"
|
||||
tempfile = "3.15.0"
|
||||
rand = { version = "0.10.0" }
|
||||
similar = "3.0.0"
|
||||
uucore = { version = "0.9.0", features = ["libc"] }
|
||||
uufuzz = "0.9.0"
|
||||
uucore = { version = "0.12.0", features = ["libc"] }
|
||||
uufuzz = "0.12.0"
|
||||
|
||||
sed = { path = ".." }
|
||||
|
||||
|
||||
+176
-83
File diff suppressed because it is too large.
Load diff
+667
-190
File diff suppressed because it is too large.
Load diff
+261
-92
File diff suppressed because it is too large.
Load diff
Loaded 20 of 38 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user