0

命令:

awk –f cs2ss.awk < dataset.csv > dataset.ss

应该使用这个程序:

BEGIN  {FS = ",";}
{
  for(i=1;i<=NF;i++) {printf("%s ", $i);}
  printf("\n");
}

从 dataset.csv 中取出所有逗号。但它只创建空文件 dataset.ss。我确保所有使用的文件都是 .txt 而不是 rtf(使用 MacBook)。我究竟做错了什么?

编辑:输入文件的屏幕截图 -

在此处输入图像描述

4

1 回答 1

1

The code works. You can test it by simply running

awk –f cs2ss.awk

And typing in sample lines of input. So you must be doing something else wrong and that thing is not apparent from here.

Things to try....

Run

awk –f cs2ss.awk < dataset.csv

If you get non-empty output to the screen, then there's something odd about the destination file or filesystem. If you get blank output to screen, there's a problem with the input file.

If it's the input file, what does

file dataset.csv

tell you?

于 2012-10-06T12:31:35.443 回答