Pham Quỳnh
New member
How do I convert multiple lines to one line in Linux?
Answer
Simply put, the idea of this sed one-liner is: append each line into the pattern space, at last replace all line breaks with the given string.
Answer
Simply put, the idea of this sed one-liner is: append each line into the pattern space, at last replace all line breaks with the given string.
- :a; – we define a label called a.
- N; – append next line into sed’s pattern space.
- $! …
- s/n/REPLACEMENT/g – replace all line breaks with the given REPLACEMENT.