loading...

re: CSV Challenge VIEW POST

FULL DISCUSSION
 

awk:

awk '
    BEGIN {FS=",";OFS=","}
    /creditcard/ {
        split($1,namearr,":")
        name = namearr[2]; gsub(/"/,"",name)
        split($5,dtarr,":")
        dt = dtarr[2]; gsub(/"| .+|-/,"",dt)
        split($6,ccarr,":")
        cc = ccarr[2]; gsub(/"|}/,"",cc)
        fname=dt ".csv"
        print name, cc >> fname
    }
' data.json
Code of Conduct Report abuse