Replace several numbers with respective tag and make a single file

Dear All,

I have a final output files as

736645|0|
13879|1|
495563|10|
127933|14|
4975|16|
49038|6|
53560|7|
135115|8|
178857|9|

Now I want to replace second column with respective tag as per the value

for e.g

0------- Success
1------- Failure
10------ unknown
.
.
.
.
.

and lastly make a single files that contains output as

736645|Success|
13879|Failure|
495563|Unknown|
127933|etc.|
4975|etc|
49038|etc|
53560|etc|
135115|etc|
178857|etc|

I use sed command but it replace correclty but then I am unable to make it in a single files

command is as

cat a.txt | sed 's/|0|/|Succes|/g' > test.wri

Please help:D

awk 'BEGIN{FS=OFS="|"}{$2=(!$2)?"Success":((($2==1)?"Failure":(($2==10)?"Unknown":"etc")))}1' file
736645|Success|
13879|Failure|
495563|Unknown|
127933|etc|
4975|etc|
49038|etc|
53560|etc|
135115|etc|
178857|etc|

Try this,

awk -F"|" 'BEGIN {
        error[0] = "Success"
        error[1] = "Failure"
        error[2] = "Fail"
        error[3] = "Error3"
        error[4] = "Error4"
        error[5] = "Error5"
        error[6] = "Error6"
        error[7] = "Error7"
        error[8] = "Error8"
        error[9] = "Error9"
        error[10] = "Unknown"
}
{if (error[$2]){print $1 FS error[$2] FS}else{print $0}}'  inputfile
perl -i -pe '%h=qw(0 Success 1 Failure 10 unknown); /\|(\d+)\|/; $k=$1; ($h{$k})? s/\|$k\|/\|$h{$k}\|/g : s/\|$k\|/\|etc|/g;'  file


ERR=( Success Failure Fail Error3 Error4 Error5 Error6 Error7 Error8 Error9 Unknown Error11 Error12 Error13 Error14 Error15 Error16 )
while IFS='|' read A B
do
echo "$A|${ERR[$B]}|"
done <file

result:

736645|Success|
13879|Failure|
495563|Unknown|
127933|Error14|
4975|Error16|
49038|Error6|
53560|Error7|
135115|Error8|
178857|Error9|