Generation

linuxFri, 30 Dec 2022

in a comma separated file called zips3.csv if the second field does not have five characters append zeroes to the beginning of the second field until it has five characters

awk -F ',' '{if length($2)<5) {printf "%s,%05d,%s,%s,%s,%s,%s\n",$1,$2,$3,$4,$5,$6,$7} else {print}}' zips3.csv > zips3.csv

Questions about programming?Chat with your personal AI assistant