I had a similar problem [here](https://forum.nim-lang.org/t/1580) and i ended 
up using the parsecsv module.
    
    
    import parsecsv, streams, os, strutils
    
    proc main() =
      var
        pageSize: int = 4096
        input = newFileStream(paramStr(1), bufSize = pageSize)
        output = open(paramStr(4), fmWrite, pageSize)
        changeAt: int
        parser: CsvParser
      
      let
        toChange = $paramStr 2
        changeWith = $paramStr 3
      
      open(parser, input, paramStr(1), quote = '\0')
      
      parser.readHeaderRow()
      
      changeAt = parser.headers.find(toChange)
      
      output.writeLine parser.headers.join(",")
      
      while readRow(parser):
        parser.row[changeAt] = changeWith
        output.writeLine parser.row.join(",")
    
    main()
    

Reply via email to