The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #6 (permalink)  
Old 11-26-2008
CarlosNC CarlosNC is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 6
If there are spaces instead of commas, just remove the -F, from the statement, and replace "," with " " in the third line.
Code:
awk '
NF == 2 {x=$1; print; next}
NF == 1 {print x" "$1}
' infile > outfile