Being able to parse that example (or CSV data likewise) is exactly why I started implementing multi-byte separation characters.
As said elsewhere in this thread, if I am happy with the result, I'll try to also implement quotation and escapes as such. Quotation being on a way higher priority than escapes. Current state in development:
$ cat films.csv
🎥Film🎥🎬🎥Year🎥🎬🎥Awards🎥🎬🎥Nominations🎥🎬🎥Director🎥
🎥12 Years a Slave🎥🎬2013🎬3🎬9🎬🎥🎥🎥 Steve McQueen🎥
🎥Argo🎥🎬2012🎬3🎬7🎬🎥🎥🎥 Ben Affleck🎥
🎥The Artist🎥🎬2012🎬5🎬10🎬🎥🎥🎥 Michel Hazanavicius🎥
🎥The King's Speech🎥🎬2010🎬4🎬12🎬🎥🎥🎥 Tom Hooper🎥
🎥The Hurt Locker🎥🎬2009🎬6🎬9🎬🎥🎥🎥 Kathryn Bigelow🎥
🎥Slumdog Millionaire🎥🎬2008🎬8🎬10🎬🎥🎥🎥 Danny Boyle🎥
🎥No Country for Old Men🎥🎬2007🎬4🎬8🎬🎥🎥🎥 Joel Coen
🎥🎥 Ethan Coen🎥
🎥The Departed🎥🎬2006🎬4🎬5🎬🎥🎥🎥 Martin Scorsese🎥
$ head -1 films.csv | dump
DUMP 0.6.01
00000000 F0 9F 8E A5 46 69 6C 6D F0 9F 8E A5 F0 9F 8E AC ....Film........
00000010 F0 9F 8E A5 59 65 61 72 F0 9F 8E A5 F0 9F 8E AC ....Year........
00000020 F0 9F 8E A5 41 77 61 72 64 73 F0 9F 8E A5 F0 9F ....Awards......
00000030 8E AC F0 9F 8E A5 4E 6F 6D 69 6E 61 74 69 6F 6E ......Nomination
00000040 73 F0 9F 8E A5 F0 9F 8E AC F0 9F 8E A5 44 69 72 s............Dir
00000050 65 63 74 6F 72 F0 9F 8E A5 0A ector.....
$ perl -C3 -MCSV -E'csv (out => *STDOUT, in => csv (in => "films.csv", sep => "\N{CLAPPER BOARD}"))'
"🎥Film🎥","🎥Year🎥","🎥Awards🎥","🎥Nominations🎥","🎥Director🎥"
"🎥12 Years a Slave🎥",2013,3,9,"🎥🎥🎥 Steve McQueen🎥"
"🎥Argo🎥",2012,3,7,"🎥🎥🎥 Ben Affleck🎥"
"🎥The Artist🎥",2012,5,10,"🎥🎥🎥 Michel Hazanavicius🎥"
"🎥The King's Speech🎥",2010,4,12,"🎥🎥🎥 Tom Hooper🎥"
"🎥The Hurt Locker🎥",2009,6,9,"🎥🎥🎥 Kathryn Bigelow🎥"
"🎥Slumdog Millionaire🎥",2008,8,10,"🎥🎥🎥 Danny Boyle🎥"
"🎥No Country for Old Men🎥",2007,4,8,"🎥🎥🎥 Joel Coen"
"🎥🎥 Ethan Coen🎥"
"🎥The Departed🎥",2006,4,5,"🎥🎥🎥 Martin Scorsese🎥"
$
Enjoy, Have FUN! H.Merijn
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.