Guest User

Untitled

a guest
Jan 12th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. proc csv {file} {
  2.  
  3. # Abrimos el csv
  4. set fs [open $file]
  5. set buffer [split [read $fs] \n]
  6. close $fs
  7.  
  8. # Recorremos el fichero línea a línea
  9. foreach line [lsort $buffer] {
  10. #Añadimos la categoría del array
  11. set CatArray "01"
  12. #cat_discos_25_mm, 100, 1, Copa Plateada, 12cm, 20.00€
  13. #100-1-01, Copa Plateada, 12cm, 20.00€
  14. #
  15. set cat [lindex [split $line {,}] 1]
  16. set Numero [lindex [split $line {,}] 2]
  17. set rest [join [lrange [split $line {,}] 3-end] {,}]
  18. return $cat-$Numero-$CatArray,$rest
  19.  
  20. }
  21. }
Add Comment
Please, Sign In to add comment