I have 3 strings: string1 string2 string3
I want to export file.csv
I try to use
echo "string1,string2,string3" >> file.csv
but its not working
I have 3 strings: string1 string2 string3
I want to export file.csv
I try to use
echo "string1,string2,string3" >> file.csv
but its not working
File handling in Tcl takes a few more commands (but is more efficient when you're writing many lines as a result):
set f [open file.csv w]
puts $f "string1,string2,string3"
close $f
The w
is critical: it says to open the file for writing.
If you're doing a lot of CSV writing, use the package in Tcllib for the job. It handles complicated edge cases for you.