cat file.csv | awk -F '=' '{gsub(/n/,"1",$2)};{print}'
while replace string with number the = separator vanishing file:
a=a+b
c=n+m
o/p:
a=a+b
c 1+m
but i want o/p like
a=a+b
c=1+m
cat file.csv | awk -F '=' '{gsub(/n/,"1",$2)};{print}'
while replace string with number the = separator vanishing file:
a=a+b
c=n+m
o/p:
a=a+b
c 1+m
but i want o/p like
a=a+b
c=1+m
Change your script to this:
awk -F '=' -v OFS='=' '{gsub(/n/,"1",$2); print}' file.csv
The default output field separator is , so if awk touches the record it will change it from
=
unless you specify otherwise.
I combined your two action blocks; there's no need to have two separate ones.