Skip to content

Instantly share code, notes, and snippets.

@offby1
Forked from ysinc88/readme.txt
Last active November 11, 2015 18:14
Show Gist options
  • Save offby1/d01516086b3c7f2b71a7 to your computer and use it in GitHub Desktop.
Save offby1/d01516086b3c7f2b71a7 to your computer and use it in GitHub Desktop.
Creating new lines from the commas inside quotes
So I have no code, because i have no idea how to do this...
I am looking for a link to start reading...
Taking this sample row:
original:
--bRP68Ey4M,Natalie Imbruglia Torn,16,0,USD,"Torn,,Torn,","GB1109700440,,GBARL0400487,",,",emipub|UMPG,,emipub|UMPG","Natalie Imbruglia,,Various,"
desired output:
=--bRP68Ey4M,Natalie Imbruglia Torn,16,0,USD,Torn,GB1109700440,,,Natalie Imbruglia
=--bRP68Ey4M,Natalie Imbruglia Torn,16,0,USD,,,,emipub|UMPG,
=--bRP68Ey4M,Natalie Imbruglia Torn,16,0,USD,Torn,GBARL0400487,,,Various
=--bRP68Ey4M,Natalie Imbruglia Torn,16,0,USD,,,,emipub|UMPG,
I would like to create new lines based on the commas inside columns 6,7,9 and 10 while keeping all other fields identical
import codecs
import csv
import sys
sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())
with open('sample.csv', encoding='utf-8') as inf:
r = csv.reader(inf)
for line in r:
print(line)
--4l5kaq8YE Como fazer Pasta Cicatrizante para Bonsai 50 0.0007 USD ,Munk, Munk ,US8640576007 ,R. Carlos Nakai
--8OXQAWPvo Jay-z Ft. Linkin Park - Numb/Encore 35 0.0000 USD Numb/Encore, USWB10403681, ,T0721717118 ,SonyATV|emipub|UMPG Jay-Z/ Linkin Park,
--CzQEAzt2Q VH1 Classic All Time Hits 2 0.0000 USD Where Do Broken Hearts Go,Where Do Broken Hearts Go, USAV70000017,USAR10000230, ,,T0702052116 ,,SonyATV|BMGRightsManagement Whitney Houston,Whitney Houston,
--FAhDMhJSo Daniele Silvestri - Kunta Kinte 17 0.0016 USD Kunta Kinte IT5080700008 Daniele Silvestri
--TwfsHgA6U The Charlatans - Weirdo 81 0.0068 USD ,Wierdo,Weirdo ,GBAZP9700261,GB1419900027 T0114384245,, WarnerPub,, ,The Charlatans,The Charlatans
--U-cJo7ieg Lo Que Más Te Gustó De Mi (El Anzuelo + Lo Que Más Te Gus... 290 0.1557 USD Lo Que Más Te Gustó De Mi (El Anzuelo + Lo Que Más Te Gustó D... ES1081100017 Bunbury
--bapNF13kM Jus did my make-up. 1 0.0000 USD Going Under, USWU30200108, ,T0717734036 ,BMGRightsManagement Evanescence,
--d8Xezd2Qg tousen kaname's theme song 3 0.0000 USD If Everyone Cared, NLA320581341, ,T9012585374 ,WarnerPub Nickelback,
--tIeNXY4-A 1 0.0000 USD Vivimi, IT7060400013, ,T9007984909 ,WarnerPub Laura Pausini,
-01HrIvcb3M Pelea o Muere 1 0.0000 USD Faint (Album Version), USWB10300468, ,T0717247818 ,UMPG Linkin Park,
-0BvuARr1jk Para no olvidar (con Lito Nebbia-made in Argentina 05) 14 0.0106 USD Para no olvidar ES1040600450 Andres Calamaro
-0DO1mBpmVU Lavern Baker - Just a Closer Walk With Thee (1957) 3 0.0025 USD Lavern Baker - Just a Closer Walk With Thee (1957), DEBL60633727, ,T0702429897 ,WarnerPub|emipub Lavern Baker,
-0Tn59OZCGE The Proclaimers - Misty Blue 8 0.0007 USD Misty Blue GB0308700520 The Proclaimers
-0UvJ0PIyUs Britney Spears - Womanizer [ HD EMPRESA ALARCON ] 10 0.0001 USD ,Womanizer (Director's Cut),Womenizer, ,USZM20800810,USJI10801442, ,,,T9027562158 ,,,SonyATV|UMPG ,Britney Spears,Britney Spears,
-0XvCEoqnWc El Sueño de Morfeo "Ojos de cielo" (A Solas 2005) 54 0.0003 USD 0000442158A_SUENO_DE_MORFEO_EL_002.mp4, ,T0420152380 ,WarnerPub|BMGRightsManagement
-0cnx7j-3ZY 302 0.2820 USD ,El Estilo de Peter La Anguila ,ES5021300062 ,Los Pichy Boys feat. Peter La Anguila
-0eCqTFa3Dg Westlife - The Making Of 'Something Right' 112 0.1433 USD The Making Of 'Something Right' GB1100800046 Westlife
-0sEkt67YBk Thalia - Amar sin ser amada 2 0.0000 USD Amar Sin Ser Amada, USELV0500029, ,T0723592855 ,WarnerPub|SonyATV Thalia,
-0tWuoJ7gXE Auxman "GO!" Minipromo 1 0.0000 USD Go IT0211003201 Auxman
-0wasWg7Hyo Yu-Gi-Oh! in the end 2 0.0000 USD In The End (Album Version), USWB10002407, ,T0716894608 ,UMPG Linkin Park,
-0wbtk6_vpE No, No, No Part 2 (featuring Wyclef Jean) 92 0.0587 USD No, No, No Part 2 (featuring Wyclef Jean), USSM20700889, ,T0709173987 ,WarnerPub Destiny's Child,
-0wfHL5jr68 Magan & Rodriguez Suck My Spanish Version 19 0.0090 USD Suck My ES5050700576 Magan and Rodriguez
-1KPh0XcaJA Supersubmarina - Ana (Directo La Riviera) 3 0.0000 USD ,Ana (Directo La Riviera) ,ES1021200159 ,Supersubmarina
-1NreF_nzQU The The - Dogs Of Lust (Extended Version) 1 0.0000 USD Dogs Of Lust GB0209300001 The The
-1X8MFJsM1k Chemical Brothers - Let Forever Be (with lyrics) - HD 2 0.0000 USD Let Forever Be (2003 Digital Remaster) GB1200300870 The Chemical Brothers
-1XHKc5tNFc MIKE CANDYS feat. EVELYN & PATRICK MILLER - 2012 (If The World Would End) 50 0.0000 USD 2012 (If The World Would End),2012 (If The World Would End) (Video) [WEB].wmv, CH3131200110,CH3131200110, MIKE CANDYS feat. EVELYN & PATRICK MILLER,Mike Candys Evelyn & Patrick Miller,
-1YwNMC20P4 Soul II Soul - Back To Life 1 0.0000 USD Back To Life (However Do You Want Me), GB1208900373, ,T0113706470 ,WarnerPub|SonyATV|emipub Soul II Soul,
-1jAMx7m3UY DEF CON DOS - Que Dice La Gente (Version 2011) 135 0.1690 USD ,Que Dice La Gente ,ES1151100064 ,DEF CON DOS
-1m9BN2f5Vg משינה - אז למה לי פוליטיקה עכשיו (אנפלאגד) - קליפ (2009) 6 0.0000 USD ,למה לי פוליטיקה עכשיו ,IL1011120048 ,משינה
-1nzoCpCMhU (Get Your Kicks On) Route 66 - Nat King Cole 13 0.0000 USD (Get your kicks on) route 66, ITO151003220, ,T0701273393 ,WarnerPub|hfa Nat King Cole,
-1pCOR9Rv9M Help I'm Alive - Acoustic 233 0.2037 USD Help I'm Alive - Live, CARB80801801, ,T9019461202 ,BMGRightsManagement Metric,
-1pfBw53amc The Kooks - Eddie's Gun 393 0.2887 USD Eddie's Gun GB1200500014 The Kooks
-1skaL-Kw78 Evangelion - Faint AMV 1 0.0000 USD Faint (Album Version), USWB10300468, ,T0717247818 ,UMPG Linkin Park,
-1yL8ERcL9s Overburdened - Disturbed 5 0.0000 USD Overburdened, USRE10501018, ,T0723209797 ,WarnerPub Disturbed,
-2-9UwHpB6U MONDOTEK ALIVE- THE ELECTRO REVOLUTION 9 0.0000 USD Alive, FR32P0764331, ,T8024356466 ,SonyATV|hfa Mondotek,
-24UuUl_rvE Julieta Venegas Eres Para Mi 2 0.0000 USD Eres Para Mi, MXV010600745, ,T0420979856 ,WarnerPub|emipub Julieta Venegas A Dueto Con Anita Tijoux,
-2KBgXThyOo Faithless - Miss U Less, See U More 399 0.1589 USD ,Miss U Less, See U More ,GB1100401310 T0111949906, WarnerPub|emipub|UMPG, ,Faithless
-2SeFnvs73A Red Hot Chili Peppers - Don't Forget Me 39 0.0000 USD Don't Forget Me, USWB10201692, ,T0714939975 ,WarnerPub Red Hot Chili Peppers,
-2cfRvBt3ok Jay sean - Stolen 1 0.0000 USD Stolen GB1200400241 Jay Sean
-2fP7tj3YGI Bunbury - San Cosme Y San Damián (Directo Madrid) 286 0.1219 USD San Cosme Y San Damián(Directo Madrid) (Directo Madrid) ES1080300240 Bunbury
-2kSkYifxHA George Michael - A Different Corner (Subtitulada) 7 0.0000 USD A Different Corner, GB0200202155, ,T0700433824 ,WarnerPub George Michael,
-2xSdaG1KFE Estopa - Spot Estopa/Macarra Ya A La Venta 9 0.0011 USD Spot Estopa/Niño -26 Febrero ES1020800074 Estopa
-3-KQDNttNE Eagle-Eye Cherry - Falling in love again 119 0.0000 USD Falling In Love Again, USSM20402443, ,T0000729521 ,Kobalt_Publishing_123 Eagle-Eye Cherry,
-32TOD2kg3g מוניקה סקס- איש קש 4 0.0000 USD ,איש קש ,IL1000000737 ,מוניקה סקס
-373JIuVHew En Un Rincon Del Alma - Versión Acústica / Una Noche En E... 1468 1.3810 USD ,En Un Rincon Del Alma Versión Acústica / Una Noche En El Teat... ,ES1701100143 emipub, ,David Bisbal
-3CyIVLb2Ac אהוד בנאי - רוחות הצפון 1 0.0200 USD ,רוחות הצפון ,IL1010005163 ,אהוד בנאי
-3J2xO2LLLI Entrevista Miguel Bosé 2012 74 0.0730 USD ,Entrevista Miguel Bose 2012.mp4,Aire soy (feat. Ximena Sariñana) ,,ES5151201061 emipub,, ,,Miguel Bose
-3P2Jwz67fA Angel Eyes in the Style of "Jeff Healey Band" with lyrics (no lead vocal) 3 0.0000 USD Angel Eyes, USK4W0730195, ,T0702319718 ,UMPG Jeff Healey Band,
-3hoh489yXQ Linkin Park-Numb.3gp 1 0.0000 USD Numb, USWBV0300206, ,T0717247852 ,UMPG Linkin Park,
-3kc1a5F83E duran duran-serious 18 0.0000 USD Serious (2003 Digital Remaster), GB0400302500, ,T0714068720 ,emipub|BMGRightsManagement Duran Duran,
-3mTMF5QYnc Roger Sanchez ft Far East Movement - '2Gether' (Extended Mix) 18 0.0000 USD 2gether,,2gether, ,,USV8J1000001, ,T9053136122,, ,WarnerPub|SonyATV,,emipub Roger sanchez,,Far East Movement,
-3qh6AIsb-Y החלונות הגבוהים - ילדה קטנה 3 0.0000 USD ,ילדה קטנה ,IL1000000474 ,החלונות הגבוהים
-3txR7kaAus Ida Corr vs Fedde le Grand - Let me Think About It HD 1 0.0000 USD Let Me Think About It, GBD580700210, ,T0028850874 ,WarnerPub|Unmappable Publisher|UMPG Ida Corr, Fedde Le Grand,
-48rDJexP6c BY MSLF - LINKIN PARK 1 0.0000 USD By_Myslf, USWB10201929, ,T0716894664 ,UMPG Linkin Park,
-4HJJ8XjZvA How To Love - Lil Wayne Piano Tribute 1 0.0000 USD How To Love, USG7D1158104, ,T9066573248 ,emipub|UMPG Piano Tribute Players,
-4OLn_Y4xHk Alex Ubago- Aunque No Te Vuelva A Ver 354 0.2403 USD Aunque no te pueda ver ES1010300850 Alex Ubago
-4S9gQb9PjM Olly Murs - Please Don't Let Me Go [Official Video] 898 0.4888 USD Please Don't Let Me Go, GBARL1000785, ,T9060278684 ,WarnerPub|BMGRightsManagement|UMPG Olly Murs,
-4XdREN2V-g AYNA-Severek ayrilanlar 2 0.0000 USD Severek Ayrılanlar TR0200500197 Ayna
-4Z1Tlp3jZM 005 GVB Reunion V1 14 0.0016 USD ,Born Again [Live] ,US3270404998 ,Bill & Gloria Gaither
-4dg9FqFTwE Nek - Vulnerabile (Backstage videoclip) 6 0.0000 USD ,Vulnerabile ,IT5591100003 T9018609502, ,Nek
-4gP6n-Uh8o Digital Girl - Jamie Foxx feat. Kanye West & The Dream 26 0.0007 USD Digital Girl Remix feat. Drake, Kanye West & The Dream, ,T9023667609 ,WarnerPub|hfa|emipub|UMPG Jamie Foxx,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment