title: awk concatenate lines of files and files into single file
body: <p>I would like to concatenate several lines of a file to a single line and then again each file separated as a new record in the file.</p>
  
  <p>file1.txt</p>
  
  <pre><code>aaa bbb ccc
  ddd eee fff
  </code></pre>
  
  <p>file2.txt</p>
  
  <pre><code>hhh iii jjj
  kkk lll mmm
  </code></pre>
  
  <p>newfile.txt</p>
  
  <pre><code>file1.txt aaa bbb ccc ddd eee fff
  file2.txt hhh iii jjj kkk lll mmm
  </code></pre>
  
  <p>This is what I came up with, but can't get the files separated as records.</p>
  
  <pre><code> gawk  -v ORS=" " "LF != FILENAME { print FILENAME; LF=FILENAME }; {$1=$1} 1; END { printf("\n");}"  *.txt &gt;newfile.txt
  </code></pre>