Thank you RudiC,
I realised that I have a comma more by mistake at the end of last line but the comma is next to "m". So my final like it getting messy ...
it should be
{"gender": "m", "age": "15", "folder": "data3"}
the results that i get for the last line is
,m3data3
one question ... how would you reverse this considering the other way around there are three options (m,f, NA)
I tried with f only but it does not detect the pattern
awk '/gender/ {gsub (/[ "}]*/, _); T = $6 $2; sub ("f", _, T); print " echo mv " $2 " " T}' FS="[:,]" detail.json | sh
Which is an indicator for an Non-*nix-text, probably created by an MS application. Try - if available - dos2unix to convert your input file. Other means have been published in these forums as well.
Not sure if this works for you: replace gsub (/[ "}]*/, _) with gsub (/[ \r"}]*/, _) . Be aware that the space in the search pattern is a <space> plus a <TAB> char!