I have this output:
30.1.2003
3.3.2003
25.12.2003
I want to make print each value except the year in two digits (might have leading values). i.e
30.01.2003
03.03.2003
25.12.2003
You can use printf:
echo 30.1.2003 | tr . ' ' | xargs printf '%02d.%02d.%04d\n'
awk -F. -v OFS="." '{for(i=1;i<=NF;i++)$i=(length($i)<2?"0":"")$i}7' file
if your output was from some process, do :
yourApp|awk -F. -v OFS="." '{for(i=1;i<=NF;i++)$i=(length($i)<2?"0":"")$i}7'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With