I have a file like this:
123123213,456,be
124243233,4346,ytr
123123123,436535,uytr
324234324,322,yt
234324323,32,tyutr
I want to zero-pad the middle field to give the result:
123123213,00000456,be
124243233,00004346,ytr
123123123,00436535,uytr
324234324,00000322,yt
234324323,00000032,tyutr
How do I make a script that woud do this?
I've seen an example like this
awk '{ $6=sprintf("%06s", $6); print $0}'
but I don't really understand it and thus can't get it working.