Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

replace a newline using sed linux bash

sed ':a;N;$!ba;s/
/ /g' file

:a create a label 'a'
N append the next line to the pattern space
$! if not the last line, ba branch (go to) label 'a'
s substitute, /
/ regex for new line, / / by a space, /g global match (as many times as it can)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #replace #newline #sed #linux #bash
ADD COMMENT
Topic
Name
8+1 =