Conditional edit for a field using sed

Hi

I want to repalce a field in a txt file on solaris with say 100 records and each record having a total of 10 fields separated by a ~ .

based on the following condition the record should be edited or else the record should be written as it is to a

if the seventh field is 'XX' and if length of eight feild is 15
then eight field should be appended by '000'

The new file should have the records which matched the condition and were edited and also the records which were not edited.

Can anybody help me with a sed command to do the same?

nawk -F'~' '$7 == "XX" && length($8) == 15 {$8=$8 "000"}1' OFS='~' myFile > myFileNew

Thanks !!! that works.