// pnyx -e=documentation pncs.cmd.examples.documentation.library.ExampleLine parseDelimiter public static void parseDelimiter() { const String input = "a|b|c|d|e|f|g"; using (Pnyx p = new Pnyx()) { p.readString(input); p.sed("[aceg]", @"\0\0", "gi"); // duplicates every other char p.parseDelimiter("|"); p.print("$1,$3,$5,$7|$2,$4,$6"); p.writeStdout(); } // outputs: aa,cc,ee,gg|b,d,f }
// pnyx -e=documentation pncs.cmd.examples.documentation.library.ExampleStateMachine teeMultiple public static void teeMultiple() { using (Pnyx p = new Pnyx()) { p.readString("clientId: 123456\n"); p.tee(p2 => { p2.write("copy.txt"); // outputs: clientId: 123456 }); p.parseDelimiter(": "); p.selectColumns(2); p.tee(p2 => { p2.write("ids.txt"); // outputs: 123456 }); p.print("delete from client where id = $0;"); p.writeStdout(); // outputs: delete from client where id = 123456; } }