(Video materials in preparation)
tocsv : Converts a space delimited file to a CSV file
Usage : tocsv <f1> <f2> ... <file>
Option : -s<space_string>
-n<null_string>
Version : Tue Jan 9 09:02:34 JST 2024
Edition : 1
Converts a space delimited file to a CSV file.
The fields specified as f1, f2, f3... are considered "String 1"
and are enclosed in quotes when converted.
Fields not specified are considered "String 0" and are not enclosed
in quotes.
If the file name is omitted or specified as "-" then the command
reads from standard input.
1.The string "_" by itself is converted to a null string.
(-n option changes "_")
2.The string \c is converted to c.
3.The backslash character \ by itself is converted to a space
4.The underscore is converted to a space if it occurs in a string.
(-s option changes "_")
5.\n at the end of a line is converted automatically to \r\n.
6.Within String 1, " is converted to "".
$ cat data
a _ \_ \ b_c b\_c "
$ tocsv 1/NF data
"a","","_"," ","b c","b_c",""""
$ tocsv data
a,,_, ,b c,b_c,"