1
0
mirror of https://github.com/chmln/sd synced 2024-07-05 15:18:35 +00:00

Readme: fix the sed slashes example

This commit is contained in:
Rico Sta. Cruz 2020-03-03 16:34:14 +11:00 committed by GitHub
parent 0cfe1b766c
commit e9e3a4d326
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,7 +37,7 @@ Some cherry-picked examples, where `sd` shines:
- Extracting stuff out of strings containing slashes:
- sd: `echo "sample with /path/" | sd '.*(/.*/)' '$1'`
- sed: use different delimiters every time depending on expression so that the command is not completely unreadable
- `echo "sample with /path/" | sed -E 's/.*(/.*/)/\1/g'`
- `echo "sample with /path/" | sed -E 's/.*(\\/.*\\/)/\1/g'`
- `echo "sample with /path/" | sed -E 's|.*(/.*/)|\1|g'`
- In place modification of files:
- sd: `sd before after file.txt`