title: How to concatenate multiple lines of output to one line?
body: <p>If I run the command <code>cat file | grep pattern</code>, I get many lines of output. How do you concatenate all lines into one line, effectively replacing each <code>"\n"</code> with <code>"\" "</code> (end with <code>"</code> followed by space)?</p>
  
  <p><code>cat file | grep pattern | xargs sed s/\n/ /g</code> 
  isn't working for me.</p>