Tabs for column headings? --key_cols bug

Help
2009-06-10
2013-04-23
  • Alex McLintock
    Alex McLintock
    2009-06-10

    When I create my own csv files I dont have a header row.

    Since this tool needs one I added it in... eg

    perl lcsvdiff.pl --key_cols=num,book,ccy reference.csv test.csv

    Unfortunately the header row must be tab separated, not comma separated....

    eg

    alex@fforde:~/projects/LRpt$ head -2 reference.csv
    num,book,ccy,ccy2,curve,tenor1,value1,tenor2,value2,tenor3,value3,tenor4,value4,,tenor5,value5,tenor6,value6,tenor7,value7,tenor8,value8,tenor9,value9,tenor10,value10,tenor11,value11
    1520310,EDSFPBAJM001,USD,USD,USD :Std,3M,0.229613,1Y,0,2Y,0,3Y,0,5Y,0,7Y,0,10Y,0,15Y,0,20Y,0,25Y,0,30Y,0

    results in

    alex@fforde:~/projects/LRpt$ perl lcsvdiff.pl --key_cols=num,book,ccy reference.csv test.csv
    No column num reference.csv at /usr/local/share/perl/5.8.8/LRpt/Collection.pm line 197, <GEN0> line 1001.
    No column book reference.csv at /usr/local/share/perl/5.8.8/LRpt/Collection.pm line 197, <GEN0> line 1001.
    No column ccy reference.csv at /usr/local/share/perl/5.8.8/LRpt/Collection.pm line 197, <GEN0> line 1001.
    No column num test.csv at /usr/local/share/perl/5.8.8/LRpt/Collection.pm line 197, <GEN1> line 1001.
    No column book test.csv at /usr/local/share/perl/5.8.8/LRpt/Collection.pm line 197, <GEN1> line 1001.
    No column ccy test.csv at /usr/local/share/perl/5.8.8/LRpt/Collection.pm line 197, <GEN1> line 1001.
    alex@fforde:~/projects/LRpt$

    --------

    If I change the header row to use tabs it works.... :-(

    alex@fforde:~/projects/LRpt$ head -2 reference.csv
    num    book    ccy    ccy2    curve    tenor1    value1    tenor2    value2    tenor3    value3    tenor4    value4        tenor5    value5 tenor6 value6 tenor7 value7 tenor8 value8 tenor9 value9 tenor10 value10 tenor11 value11
    1520310,EDSFPBAJM001,USD,USD,USD :Std,3M,0.229613,1Y,0,2Y,0,3Y,0,5Y,0,7Y,0,10Y,0,15Y,0,20Y,0,25Y,0,30Y,0
    alex@fforde:~/projects/LRpt$ perl lcsvdiff.pl --key_cols=num,book,ccy reference.csv test.csv
    SCHEMA: num    book    ccy    ccy2    curve    tenor1    value1    tenor2    value2    tenor3    value3    tenor4    value4        tenor5value5 tenor6 value6 tenor7 value7 tenor8 value8 tenor9 value9 tenor10 value10 tenor11 value11
    DEL( 1075373,EDSFPIGDSPX,USD,USD,USD :Std,3M,2.33607,1Y,0,2Y,0,3Y,0,5Y,0,7Y,0,10Y,0,15Y,0,20Y,0,25Y,0,30Y,0## )
    INS( 1075373,EDSFPIGDSPX,USD,USD,USD :Std,3M,2.33607,1Y,0.0000000,2Y,0,3Y,0,5Y,0,7Y,0,10Y,0,15Y,0,20Y,0,25Y,0,30Y,0## )
    etc etc