Starting with a string of an unspecified length, I need to make it exactly 43 characters long (front-padded with zeroes). It is going to contain IP addresses and port numbers. Something like:
### BEFORE
# Unfortunately includes ':' colon
66.35.205.123.80-137.30.123.78.52172:
### AFTER
# Colon removed.
# Digits padded to three (3) and five (5)
# characters (for IP address and port numbers, respectively)
066.035.005.123.00080-137.030.123.078.52172
This is similar to the output produced by tcpflow.
Programming in Bash. I can provide copy of script if required.
If it's at all possible, it would be nice to use a bash built-in, for speed. Is printf
suitable for this type of thing?