2015-05-28 07:29:09 -04:00
|
|
|
#+PROPERTY: results silent scalar
|
|
|
|
#+Title: a collection of examples for ob-sed tests
|
|
|
|
|
|
|
|
* Test simple execution of sed script
|
|
|
|
:PROPERTIES:
|
|
|
|
:ID: C7E7CA6A-2601-42C9-B534-4102D62E458D
|
|
|
|
:END:
|
|
|
|
|
|
|
|
#+NAME: ex1
|
|
|
|
#+BEGIN_EXAMPLE
|
|
|
|
An example sentence.
|
|
|
|
#+END_EXAMPLE
|
|
|
|
|
|
|
|
#+BEGIN_SRC sed :stdin ex1
|
|
|
|
s/n example/ processed/
|
|
|
|
2 d
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Test :in-file header argument
|
|
|
|
:PROPERTIES:
|
|
|
|
:ID: 54EC49AA-FE9F-4D58-812E-00FC87FAF562
|
|
|
|
:END:
|
|
|
|
|
|
|
|
#+BEGIN_SRC sed :in-file test1.txt
|
|
|
|
s/test/tested/
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Test :cmd-line header argument
|
|
|
|
:PROPERTIES:
|
|
|
|
:ID: E3C6A8BA-39FF-4840-BA8E-90D5C4365AB1
|
|
|
|
:END:
|
|
|
|
|
2022-10-06 15:14:17 -04:00
|
|
|
/Note:/ Use =-i.backup= instead of just =-i= because the BSD =sed=,
|
|
|
|
unlike the GNU =sed=, requires =-i <extension>=.
|
|
|
|
|
|
|
|
#+BEGIN_SRC sed :in-file test2.txt :cmd-line "-i.backup"
|
2015-05-28 07:29:09 -04:00
|
|
|
s/test/tested again/
|
|
|
|
#+END_SRC
|