Step 1:
Generate a random number to be used for replacement. This is done with something similar to $(($RANDOM * 32768 + $RANDOM))
; if you need more details, let me know.
Step 2:
Use tr
to replace all numbers with their "capital" versions, and replace them with the numbers you need. So for your example, to replace just the 1, 2, and 3, you would run:
cat inputfile | tr '1' '!' | tr '2' '@' | tr '3' '#' | tr '4' '$' | tr '5' '%' | tr '6' '^' | tr '7' '&' | tr '9' '(' | tr '!' '8' | tr '@' '7' | tr '#' '2' | tr '$' '8' | tr '%' '1' | tr '^' '2' | tr '&' '5' | tr '(' '7'
Note: to get the effect you need, you would need to extend the command above for it to work. Running it multiple times insted will produce the wrong results.
Output of the above command:
First_name,id,second_name,phone_number
ram,727,prakash,96
hari,872,pallavi,98
anurag,456,aakash,87
Also: note how your "expected" output is not correct. The first number should be 727, not 728.