Say I have a shell variable
$string that holds some text with several newlines, e.g.:
string="this is a test"
I would like to convert this string into a new string
new_string where all line breaks are converted into spaces:
new_string="this is a test"
print $string | sed 's/\n/ /g'
but it didn't work
I'm also wondering if there is a way of doing this using
perl -0777 's/\n/ /g' or maybe the command