Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Added CSV plugin |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
63c0c207e37d155f060fcad46e7d268e |
User & Date: | peter 2015-03-16 18:50:26.209 |
Context
2015-03-16
| ||
19:12 | CSV example check-in: dd31531248 user: peter tags: trunk | |
18:50 | Added CSV plugin check-in: 63c0c207e3 user: peter tags: trunk | |
00:08 | Code restructure check-in: be75239ba7 user: peter tags: trunk | |
Changes
Added examples/dir1/csv1.txt.
> > > | 1 2 3 | apa,bepa,cepa,depa,epa,fepa,gepa hej,fskdfjshfksdjfhsf,x,hopp,i,lingon,skogen bluff,spark,torp,kvark,voro,sex,dvargar |
Added examples/dir2/csv1.txt.
> > > | 1 2 3 | apa,bepa,cepa,depa,epa,fepa,gepa hej,x,fskdfjshfksdjfhsf,hopp,i,lingon,skogen bluff,spark,torp,kvark,voro,sex,dvargar |
Added plugins/csv.tcl.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | ##Eskil Plugin : Compare comma separated value (CSV) files # Example file for a plugin. # A plugin must start exactly like this one. # The text after : is the summary you can get at the command line # This plugin compares CSV files with some preprocessing available # A plugin must define this procedure to do the job. # side: left or right # chi: An input channel for reading the original file. # cho: An output channel for writing the processed file. proc PreProcess {side chi cho} { # Look for parameters in info string set opts(-ignore) "" set opts(-key) "" set opts(-header) 0 foreach {opt val} $::Info { set opts($opt) $val } # If any column is given by name, assume the file starts with # a header line of column names foreach col [concat $opts(-ignore) $opts(-key)] { if {![string is integer $col]} { set opts(-header) 1 } } if {$opts(-header)} { set nameLine [gets $chi] # Keep it first in file puts $cho $nameLine set nameList [split $nameLine ","] } set icol {} foreach col $opts(-ignore) { if {[string is integer $col]} { lappend icol $col } else { lappend icol [lsearch $nameList $col] } } set icol [lsort -integer $icol] set kcol {} foreach col $opts(-key) { if {[string is integer $col]} { lappend kcol $col } else { lappend kcol [lsearch $nameList $col] } } set olines {} while {[gets $chi line] >= 0} { set items [split $line ","] foreach i $icol { lset items $i "" } lappend olines $items } # Sort on keys foreach i [lreverse $kcol] { set olines [lsort -index $i $olines] } foreach items $olines { puts $cho [join $items ","] } # Signal that the file after processing should be used both # for comparison and for displaying. return 1 } |