How can I convert this :
RS.PK.03.01.4200.03.014.01
to man03140101
?
What needs to be done?
RS.PK.03.01.4200.
03.014.01
should be converted to 031401
— "0
" was removed from "014
". 01
be added to the end: 03140101
man
in the front: man03140101
I need to do hundreds of such conversions in a file.
One possibility, using awk
:
awk -F. '{ printf "man%.2d%.2d%.2d01\n", $6, $7, $8 }'
Output:
$ echo RS.PK.03.01.4200.03.014.01 | awk -F. '{ printf "man%.2d%.2d%.2d01\n", $6, $7, $8 }'
man03140101
$