I want to replace data in spcific column that the user gives with id, with a value that again is given by the user. So the user gives the id of the row, the column, and the
You code does not match your requirement at all:
the user gives the id of the row, the column, and the value to replace
which I would interpret with
awk -v row=2 -v col=3 -v new_value="Hello World" '
BEGIN { FS = OFS = "|" }
NR == row {$col = new_value}
{print}
' persons.dat.txt
Note the use of variables here:
$
symbol is like an operator that references the value of the field number given by the value (here, "$col")