31 lines
577 B
Org Mode
31 lines
577 B
Org Mode
* Using 'sed' to substitute text
|
|
|
|
"~sed~" is a stream editor for filtering and transforming text"...
|
|
|
|
This command in emacs editor
|
|
|
|
: M-x woman [RET] sed
|
|
|
|
Visits the following file with info about ~sed~
|
|
|
|
usr/share/man/man1/sed.1.gz
|
|
|
|
A brief example:
|
|
I have a long comma separated text file with strings and
|
|
need to include a line break after each comma (\n)
|
|
|
|
: cat filetest
|
|
|
|
#+RESULTS:
|
|
|'string1',|'string2', |'string3'|
|
|
|
|
Using ~sed~ and redirecting the output to "filetest1"
|
|
|
|
: $ sed 's/\,/&\n/g' filetest > filetest1
|
|
|
|
#+RESULTS:
|
|
| 'string1', |
|
|
| 'string2', |
|
|
| 'string3' |
|
|
|