X
X
xtala zen2016-11-03 12:54:44
linux
xtala zen, 2016-11-03 12:54:44

How to replace line breaks with "\n" characters?

Hey!
Tell me how, using bashor shell, can I put visible characters instead of invisible hyphens \n?
Those. given a text file of the form:

Бла
бла
бла

With the help of what commands can it be brought to mind
бла/nбла/nбла?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Surin, 2016-11-03
@BedwaRe

Here is the answer .

/home/oracle/aaa>cat text.txt
bla
blah
bleah
/home/oracle/aaa>sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/,/g' text.txt > ou
/home/oracle/aaa>cat ou
bla,blah,bleah

UPDATE: This entry is enough.
tr "\n" "n" < text.txt > ou

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question