Can anybody explain me this small script.
echo -e "\"aa;bb\";cc ;\"dd ;ee\";
ff" | awk -v RS=\" -v ORS=\" 'NR%2==0{gsub(";",",")}
{print}'
In this script fields separated by (;
), but if there is one or more (;)
inside any field then this field is surrounded by ""
.It's CSV-file
.
Therefore it is necessary to replace all (;)
in this fields
for further parsing.
awk 'BEGIN{RS="\"";ORS="\'"} $1'
. This does not work. I use sh as shell on FreeBSD. – Andry Jul 12 '13 at 09:59