Occasionally when working in a Linux/Unix environment comes the need to left pad numbers with zeros (add leading zeros to numbers). This is often done to make a series of numbers the same length. An example of doing this with awk can be seen below:
1
2
3
|
# left pad with zeros using awk
echo 99 | awk '{printf "%05d\n", $0}'
> 00099
|
Hello Friends! I am Ramana a part time blogger from Hyderabad.
0 comments:
Post a Comment