Quick Answer: How Do I Make Multiple Lines on One Line in Linux?
Contents How Do I Convert Multiple Lines to One Line in Linux? Simply Put, the Idea of This Sed One-Liner Is: Append Each Line into the Pattern Space, at Last...
Contents
How do I convert multiple lines to one line in Linux?
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.
Must Read
How do I combine multiple lines in one line?
A single command shortcut for merging multiple lines into 1 is “join lines”.
- Command + J on the Mac to join lines.
- CTRL + J on Windows.
- Edit > Lines > Join Lines.