2013-12-11 10:50:11 +00:00
|
|
|
# sed
|
|
|
|
|
2018-06-26 16:19:31 +01:00
|
|
|
> Edit text in a scriptable manner.
|
2022-11-12 13:05:16 +00:00
|
|
|
> See also: `awk`, `ed`.
|
2022-03-09 04:28:57 +00:00
|
|
|
> More information: <https://www.gnu.org/software/sed/manual/sed.html>.
|
2013-12-11 10:50:11 +00:00
|
|
|
|
2022-11-12 13:05:16 +00:00
|
|
|
- Replace all `apple` (basic regex) occurrences with `mango` (basic regex) in all input lines and print the result to `stdout`:
|
2013-12-11 10:50:11 +00:00
|
|
|
|
2022-11-12 13:05:16 +00:00
|
|
|
`{{command}} | sed 's/apple/mango/g'`
|
2013-12-11 10:50:11 +00:00
|
|
|
|
2022-11-12 13:05:16 +00:00
|
|
|
- Execute a specific script [f]ile and print the result to `stdout`:
|
2016-02-27 13:23:24 +00:00
|
|
|
|
2022-11-12 13:05:16 +00:00
|
|
|
`{{command}} | sed -f {{path/to/script.sed}}`
|
2016-02-27 13:23:24 +00:00
|
|
|
|
2022-11-12 13:05:16 +00:00
|
|
|
- Print just a first line to `stdout`:
|
2013-12-11 10:50:11 +00:00
|
|
|
|
2022-11-12 13:05:16 +00:00
|
|
|
`{{command}} | sed -n '1p'`
|