エクセルで開けないような、馬鹿でかいタブ区切りのファイルをCSVに変換するSMLです。
(例)
123.763 46.1667 0
123.775 46.1667 0
123.788 46.1667 0
123.8 46.1667 0
123.812 46.1667 0
123.825 46.1667 0
123.838 46.1667 0
123.85 46.1667 0
これがこうなります。
123.763,46.1667,0
123.775,46.1667,0
123.788,46.1667,0
123.8,46.1667,0
123.812,46.1667,0
123.825,46.1667,0
123.838,46.1667,0
123.85,46.1667,0
--------------------------------
clear()
infile = fopen("d:/tmp/xyztest.txt", "r")
outfile = fopen("d:/tmp/out.txt","w")
while(!feof(infile)) {
str$=fgetline$(infile)
delimit$ = "\t";
n = NumberTokens(str$, delimit$);
for i = 1 to (n-1) {
token$ = GetToken(str$, delimit$, i);
fprintf(outfile, "%s%s", token$, ",");
}
token$ = GetToken(str$, delimit$, n);
fprintf(outfile, "%s\n", token$);
}
fclose(infile)
fclose(outfile)