我需要将一系列用换行符格式化的文本文件转换为由换行符(\ n)分隔的单个行。例如:Bash连接并用换行符替换回车
This is an example text file
where the contents are separated
by line breaks
我想这是什么样子是:
This is an example text file\nwhere the contents are separated\nby line breaks\n
我愿意用awk,sed或任何内置的POSIX命令。
你的意思是'tr'\ r''\ n'<文件' – anubhava
糟糕,你忘了发布你的代码! StackOverflow是关于帮助人们修复他们的代码。这不是免费的编码服务。任何代码都比没有代码更好。即使你不知道如何编写它,甚至元代码也会演示你如何看待程序应该起作用。 – ghoti