bash-tutorial/tutorial/sed_subsitute.org

616 B

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
'string1', 'string2', 'string3'

Using sed and redirecting the output to "filetest1"

$ sed 's/\,/&\n/g' filetest > filetest1
'string1',
'string2',
'string3'