https://github.com/nightmachinery/rmprefix
rmprefix can 1) remove a given prefix from the lines of input 2) replace a literal string with another.
https://github.com/nightmachinery/rmprefix
awk prefix sd sed string string-manipulation string-matching
Last synced: 3 months ago
JSON representation
rmprefix can 1) remove a given prefix from the lines of input 2) replace a literal string with another.
- Host: GitHub
- URL: https://github.com/nightmachinery/rmprefix
- Owner: NightMachinery
- Created: 2020-07-30T21:15:09.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-03-17T14:57:54.000Z (over 4 years ago)
- Last Synced: 2025-05-25T00:18:27.010Z (5 months ago)
- Topics: awk, prefix, sd, sed, string, string-manipulation, string-matching
- Language: Rust
- Homepage:
- Size: 13.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# DEPRECATED
Use https://github.com/NightMachinary/prefixer instead. I'll continue to support bugfixes for `rmprefix`, as it's a very lightweight command and I still use it in my scripts, but `prefixer` is better in virtually every way.
# Installation
```
cargo install --git https://github.com/NightMachinary/rmprefix --force
```# Usage
`rmprefix` removes the given prefix from its input if present. The input is split using the given separator, by default newlines.
Usage: `rmprefix [=\n] [=\n]`
Set the separators to `\x00` for the NUL character.
`rmprefix` can also work as a search and replace tool, with this neat trick:
`rmprefix '' SEARCH_FOR_ME REPLACE_WITH_ME`
## Examples
```
echo "The jungles are green.
Some people sing.
The world is not flat.
There are two ways." | rmprefix The
```
> jungles are green.
>
>Some people sing.
>
> world is not flat.
>
>re are two ways.```
echo "123456789" "23456789" "12345" "Hi" "" "Ocean" | rmprefix 123 ' ' '|||'
```> 456789|||23456789|||45|||Hi||||||Ocean
```
echo "Butterflies are insects in the macrolepidopteran clade Rhopalocera from the order Lepidoptera, which also includes moths. Adult butterflies have large, often brightly coloured wings, and conspicuous, fluttering flight. The group comprises the large superfamily Papilionoidea, which contains at least one former group, the skippers (formerly the superfamily "Hesperioidea"), and the most recent analyses suggest it also contains the moth-butterflies (formerly the superfamily "Hedyloidea"). Butterfly fossils date to the Paleocene, about 56 million years ago." | rmprefix '' butter cheese
```> Butterflies are insects in the macrolepidopteran clade Rhopalocera from the order Lepidoptera, which also includes moths. Adult cheeseflies have large, often brightly coloured wings, and conspicuous, fluttering flight. The group comprises the large superfamily Papilionoidea, which contains at least one former group, the skippers (formerly the superfamily Hesperioidea), and the most recent analyses suggest it also contains the moth-cheeseflies (formerly the superfamily Hedyloidea). Butterfly fossils date to the Paleocene, about 56 million years ago.
# Licenses
Dual-licensed under MIT and GPL v3 or later.