Unable to prefix and postfix the special character to entire column in a csv file

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Unable to prefix and postfix the special character to entire column in a csv file

Shivakumar
I need help in the following using shellscript:
1.Get a string from the csv file -- succesfully done
For example the string is abc then i should assign % for prefix and postfix of the string i.e "%abc%". How to achieve this I tried
#!/bin/bash
temp="%"
while IFS="," read f1 f2 f3 f4
do
     echo $f4
     temp4=${temp}$f4${temp}
     echo $temp4
done < a.csv

But getting output as %abc, i dont see postfix % Please help me.

Output: %abc%