Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- proc csv {file} {
- # Abrimos el csv
- set fs [open $file]
- set buffer [split [read $fs] \n]
- close $fs
- # Recorremos el fichero línea a línea
- foreach line [lsort $buffer] {
- #Añadimos la categoría del array
- set CatArray "01"
- #cat_discos_25_mm, 100, 1, Copa Plateada, 12cm, 20.00€
- #100-1-01, Copa Plateada, 12cm, 20.00€
- #
- set cat [lindex [split $line {,}] 1]
- set Numero [lindex [split $line {,}] 2]
- set rest [join [lrange [split $line {,}] 3-end] {,}]
- return $cat-$Numero-$CatArray,$rest
- }
- }
Add Comment
Please, Sign In to add comment