The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 -->
  #5 (permalink)  
Old 05-13-2009
limshady411 limshady411 is offline
Registered User
  
 

Join Date: Aug 2005
Location: Arizona
Posts: 10
Padding with zeros

Hi all,

Referencing the awk statement here
Code:
awk -F: '{ printf "%06d: %s\n", $1,$2 }' input.txt
, I want to apply this concept to the 5th field, where I am padding 6 leading zeroes, and the rest of my fields stay the same. I tried the following:

Code:
awk -F, '{ printf "%06d, %s\n", $6,$7 }' test1.csv > test2.csv
but it won't output my first five fields or fields after the 6th field.

Please advise. Thanks much!
Lim