Arch linux 6.15.7-zen1-1-zen,
$ awk -V
GNU Awk 5.3.2, API 4.0, PMA Avon 8-g1, (GNU MPFR 4.2.2, GNU MP 6.3.0)
Start with y.csv:
4 2016201820192020
5 20162018201920202023
5 20162018201920202024
5 00000000000000002024
then, variants of printf:
$ awk '{print $1,sprintf("%020d",$2)}' y.csv
4 00002016201820192020
5 20162018201920200704
5 20162018201920200704
5 00000000000000002024
$ awk '{$2=sprintf("%020d",$2);print $1,$2}' y.csv
4 00002016201820192020
5 20162018201920200704
5 20162018201920200704
5 00000000000000002024
$ awk '{printf("%020d\n",$2)}' y.csv
00002016201820192020
20162018201920200704
20162018201920200704
00000000000000002024
$ awk '{printf("%020.0f\n",$2)}' y.csv
00002016201820192020
20162018201920200704
20162018201920200704
00000000000000002024
What's going on? The last 4 digits of the 2nd & 3rd lines are always changed, seemingly randomly, to 0704!
awk '{print $1, sprintf("%20s",$2)}' y.csvgawkhas been compiled with theMPFRandMPlibs so you should be able to use the-M(or--bignum) flag to insure you get the desired output; see thegnu.orglink mentioned KamilCuk's answer for additional details on support for this featurey.csvdoesn't contain CSV so you should rename it.