2025-03-14 21:59:59 -06:00
|
|
|
# ned
|
|
|
|
|
|
|
|
|
|
> Like `grep` but with powerful replace capabilities.
|
|
|
|
|
> Unlike `sed`, as it isn't restricted to line oriented editing.
|
2026-02-18 06:55:01 -07:00
|
|
|
> More information: <https://github.com/nevdelap/ned#ned-usage>.
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Recursively search starting in the current directory, ignoring case:
|
|
|
|
|
|
2026-02-18 06:55:01 -07:00
|
|
|
`ned {{[-i|--ignore-case]}} {{[-R|--recursive]}} '{{^[dl]og}}' {{.}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Search always showing colored output:
|
|
|
|
|
|
|
|
|
|
`ned --colors '{{^[dl]og}}' {{.}}`
|
|
|
|
|
|
|
|
|
|
- Search never showing colored output:
|
|
|
|
|
|
2026-02-18 06:55:01 -07:00
|
|
|
`ned --colors never '{{^[dl]og}}' {{.}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Search ignoring certain files:
|
|
|
|
|
|
2026-02-18 06:55:01 -07:00
|
|
|
`ned {{[-R|--recursive]}} --exclude '{{*.htm}}' '{{^[dl]og}}' {{.}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Simple replace:
|
|
|
|
|
|
2026-02-18 06:55:01 -07:00
|
|
|
`ned '{{dog}}' {{[-r|--replace]}} '{{cat}}' {{.}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Replace using numbered group references:
|
|
|
|
|
|
2026-02-18 06:55:01 -07:00
|
|
|
`ned '{{the ([a-z]+) dog and the ([a-z]+) dog}}' {{[-r|--replace]}} '{{the $2 dog and the $1 dog}}' {{.}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Replace changing case:
|
|
|
|
|
|
2026-02-18 06:55:01 -07:00
|
|
|
`ned '{{([a-z]+) dog}}' --case-replacements {{[-r|--replace]}} '{{\U$1\E! dog}}' --stdout {{.}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Preview results of a find and replace without updating the target files:
|
|
|
|
|
|
2026-02-18 06:55:01 -07:00
|
|
|
`ned '{{^[sb]ad}}' {{[-r|--replace]}} '{{happy}}' --stdout {{.}}`
|