TE
TechEcho
Home
24h Top
Newest
Best
Ask
Show
Jobs
English
GitHub
Twitter
Home
Show HN: Convert json dns data to csv
1 points
by
textmode
about 7 years ago
cat json.l<p><pre><code> #define echo ECHO #define jmp BEGIN #define p printf #define nl p("\n") #define s p(",") %s xa xb xc xd xa "\"Question\":[{\"name\": \"" ya "\", \"type\": 1}]," xb "\"type\": 1," yb "\"data\": \"" xc \" %% {xa} jmp xa; <xa>{ya} s;jmp xb; <xa>. echo; <xb>{xb} jmp xc; <xb>. <xc>{yb} jmp xd; <xc>. <xd>{xc} nl;jmp 0; <xd>. echo; \n . %% int main(){ yylex();} int yywrap(){} /* compile with something like: flex -Crfa -8 -i json.l cc -pipe lex.yy.c -static -o json usage example: json < file.json > file.csv */</code></pre>
no comments
no comments