The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 03-18-2009
aaaaargh aaaaargh is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 20
Here is mine, ugly but should do the trick

(not tested)

Code:
awk 'BEGIN{i=0}
  { content[NR]=$0; if (($0=="")) {b[i]=NR;i++} j++;} 
  END 
 { 
   for (x=0;x<=b[0];x++) 
  {print content[x] > "file1" } for (x=b[1];x<=j; x++) { print content[x] > "file2"}   
}'  /var/tmp/file