title: Grouping some lines into one
body: <p>I have an <em><a href="http://en.wikipedia.org/wiki/Hosts_%28file%29" rel="nofollow noreferrer">hosts file</a></em> and I need to group multiple lines into one, using Linux standard commands; starting with this:</p>
  
  <pre><code>127.0.0.1 name1
  127.0.0.1 name2
  127.0.0.1 name3
  ...
  127.0.0.1 nameN
  </code></pre>
  
  <p>I want this:</p>
  
  <pre><code>127.0.0.1 name1 name2 name3
  127.0.0.1 name4 name5 name6
  ...
  127.0.0.1 ... nameN
  </code></pre>
  
  <p>The ip address is always the same, and I can easily remove it to simplify the work; the file can reach 30K+ lines, so my goal is to reduce its size using as few resources as possible (I'm working on a router with OpenWRT).
  Using <em>tail</em> and <em>head</em> I can get a group of lines, but then I don't know how to put them on a single line (substite <em>\n</em> with a space doesn't seem to work).</p>