Generation

linuxFri, 30 Dec 2022

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

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

Questions about programming?Chat with your personal AI assistant