delimitted file to fixed length file

Hi, Iam new to unix. I have a variable length file seperated by delmitter "~", I need to change it to fixed length file including space instead of delimitter. To be clear.....

Input file:

Row-id name

123~name1
124~name2
125~name3

The above input file is a variable length file seperated by delimiter ~ and row-id is of 5 character length and name is a varchar of 20.

Output file:

row-id name
123 name1
124 name2
125 name3

The above is a fixed length file which has to be send to mainframe team. so they need a fixed length file.

Please let me know how to change a varaible length file to fixed length file. Thanks in advance.

Asuming you want the columns aligned to the left:

awk -F~ 'BEGIN{OFS=" "} {printf("%-5s%-20s\n"), $1,$2}' infile

Thanks a lot ..... Its working .....