2014-06-13 11:16:24 |
IanBall |
bug |
|
|
added bug |
2014-06-13 11:16:24 |
IanBall |
attachment added |
|
LUN.csv https://bugs.launchpad.net/bugs/1329736/+attachment/4130956/+files/LUN.csv |
|
2014-06-13 14:07:14 |
IanBall |
summary |
When specifying a field separator with {FS=","}, the separator is not applied tp the first line |
When specifying a field separator with {FS=","}, the separator is not applied to the first line |
|
2014-06-13 14:08:41 |
IanBall |
description |
I have a csv input file where I want to extract specific fields. When I cat that file into mawk using the {FS=","} within the brackets, the first line of output is as if the field separator was still a space instead of the comma that I specified. From the second line onwards, the comma field separator is honoured.
The first three lines of output from the command I am using are:
$ cat LUN.csv | awk '{FS=","} {print $2","$5","$14","$17","$20","$23","$26","$29","$32","$35","$77","$78","$79","$80","$81","$82","$83","$84","$85","$86","$87","$88","$89","$90","$91","$92","$93","$94","$95","$96","$97","$98}'
60,5;,naa.600601605d212700a1c3b23a8a6ae011;,naa.600601605d212700a1c3b23a8a6ae011;,naa.600601605d212700a1c3b23a8a6ae011],06/02/2014,,,,,,,,,,,,,,,,,,,,,,,,,,,
06/02/2014 12:05:22,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
06/02/2014 12:07:36,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
If I try the command using the -F "," flag instead the first line of output also has the comma field separator honoured.
The first three lines of output from the command I am using are:
$ cat LUN.csv | awk -F "," '{print $2","$5","$14","$17","$20","$23","$26","$29","$32","$35","$77","$78","$79","$80","$81","$82","$83","$84","$85","$86","$87","$88","$89","$90","$91","$92","$93","$94","$95","$96","$97","$98}'
06/02/2014 12:02:59,0.158562,0.106358,3.061710,0.102991,38.801684,2.717995,0.003367,10.031008,0.343715,0,0,0,0,218,10,16,270,0,0,0,0,0,0,47,12,0,2,4,0,0,0
06/02/2014 12:05:22,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
06/02/2014 12:07:36,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
I would expect that the behaviour of both would be the same, and specifically that of the {FS=","} would be applied to the first line as well as all following lines.
The attached file is the head of the file I am using so you can test.
The version I am using is on kubuntu 13.10, the version information output is:
$ mawk -W version
mawk 1.3.3 Nov 1996, Copyright (C) Michael D. Brennan
compiled limits:
max NF 32767
sprintf buffer 2040 |
I have a csv input file where I want to extract specific fields. When I cat that file into mawk using the {FS=","} within the brackets, the first line of output is as if the field separator was still a space instead of the comma that I specified. From the second line onwards, the comma field separator is honoured.
The first three lines of output from the command I am using are:
$ cat LUN.csv | awk '{FS=","} {print $2","$5","$14","$17","$20","$23","$26","$29","$32","$35","$77","$78","$79","$80","$81","$82","$83","$84","$85","$86","$87","$88","$89","$90","$91","$92","$93","$94","$95","$96","$97","$98}'
60,5;,naa.600601605d212700a1c3b23a8a6ae011;,naa.600601605d212700a1c3b23a8a6ae011;,naa.600601605d212700a1c3b23a8a6ae011],06/02/2014,,,,,,,,,,,,,,,,,,,,,,,,,,,
06/02/2014 12:05:22,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
06/02/2014 12:07:36,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
If I try the command using the -F "," flag instead the first line of output also has the comma field separator honoured.
The first three lines of output from the command I am using are:
$ cat LUN.csv | awk -F "," '{print $2","$5","$14","$17","$20","$23","$26","$29","$32","$35","$77","$78","$79","$80","$81","$82","$83","$84","$85","$86","$87","$88","$89","$90","$91","$92","$93","$94","$95","$96","$97","$98}'
06/02/2014 12:02:59,0.158562,0.106358,3.061710,0.102991,38.801684,2.717995,0.003367,10.031008,0.343715,0,0,0,0,218,10,16,270,0,0,0,0,0,0,47,12,0,2,4,0,0,0
06/02/2014 12:05:22,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
06/02/2014 12:07:36,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
I would expect that the behaviour of both would be the same, and specifically that of the {FS=","} would be applied to the first line as well as all following lines.
The attached file is the head of the file I am using so you can test.
The version I am using is on kubuntu 13.10, the version information output is:
$ mawk -W version
mawk 1.3.3 Nov 1996, Copyright (C) Michael D. Brennan
compiled limits:
max NF 32767
sprintf buffer 2040
Please note that although I have awk in the example command lines above, it is pointing to mawk.
$ awk -W version
mawk 1.3.3 Nov 1996, Copyright (C) Michael D. Brennan
compiled limits:
max NF 32767
sprintf buffer 2040 |
|
2014-06-13 14:09:27 |
IanBall |
description |
I have a csv input file where I want to extract specific fields. When I cat that file into mawk using the {FS=","} within the brackets, the first line of output is as if the field separator was still a space instead of the comma that I specified. From the second line onwards, the comma field separator is honoured.
The first three lines of output from the command I am using are:
$ cat LUN.csv | awk '{FS=","} {print $2","$5","$14","$17","$20","$23","$26","$29","$32","$35","$77","$78","$79","$80","$81","$82","$83","$84","$85","$86","$87","$88","$89","$90","$91","$92","$93","$94","$95","$96","$97","$98}'
60,5;,naa.600601605d212700a1c3b23a8a6ae011;,naa.600601605d212700a1c3b23a8a6ae011;,naa.600601605d212700a1c3b23a8a6ae011],06/02/2014,,,,,,,,,,,,,,,,,,,,,,,,,,,
06/02/2014 12:05:22,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
06/02/2014 12:07:36,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
If I try the command using the -F "," flag instead the first line of output also has the comma field separator honoured.
The first three lines of output from the command I am using are:
$ cat LUN.csv | awk -F "," '{print $2","$5","$14","$17","$20","$23","$26","$29","$32","$35","$77","$78","$79","$80","$81","$82","$83","$84","$85","$86","$87","$88","$89","$90","$91","$92","$93","$94","$95","$96","$97","$98}'
06/02/2014 12:02:59,0.158562,0.106358,3.061710,0.102991,38.801684,2.717995,0.003367,10.031008,0.343715,0,0,0,0,218,10,16,270,0,0,0,0,0,0,47,12,0,2,4,0,0,0
06/02/2014 12:05:22,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
06/02/2014 12:07:36,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
I would expect that the behaviour of both would be the same, and specifically that of the {FS=","} would be applied to the first line as well as all following lines.
The attached file is the head of the file I am using so you can test.
The version I am using is on kubuntu 13.10, the version information output is:
$ mawk -W version
mawk 1.3.3 Nov 1996, Copyright (C) Michael D. Brennan
compiled limits:
max NF 32767
sprintf buffer 2040
Please note that although I have awk in the example command lines above, it is pointing to mawk.
$ awk -W version
mawk 1.3.3 Nov 1996, Copyright (C) Michael D. Brennan
compiled limits:
max NF 32767
sprintf buffer 2040 |
I have a csv input file where I want to extract specific fields. When I cat that file into mawk using the {FS=","} within the brackets, the first line of output is as if the field separator was still a space instead of the comma that I specified. From the second line onwards, the comma field separator is honoured.
The first three lines of output from the command I am using are:
$ cat LUN.csv | awk '{FS=","} {print $2","$5","$14","$17","$20","$23","$26","$29","$32","$35","$77","$78","$79","$80","$81","$82","$83","$84","$85","$86","$87","$88","$89","$90","$91","$92","$93","$94","$95","$96","$97","$98}'
60,5;,naa.600601605d212700a1c3b23a8a6ae011;,naa.600601605d212700a1c3b23a8a6ae011;,naa.600601605d212700a1c3b23a8a6ae011],06/02/2014,,,,,,,,,,,,,,,,,,,,,,,,,,,
06/02/2014 12:05:22,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
06/02/2014 12:07:36,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
If I try the command using the -F "," flag instead the first line of output also has the comma field separator honoured.
The first three lines of output from the command I am using are:
$ cat LUN.csv | awk -F "," '{print $2","$5","$14","$17","$20","$23","$26","$29","$32","$35","$77","$78","$79","$80","$81","$82","$83","$84","$85","$86","$87","$88","$89","$90","$91","$92","$93","$94","$95","$96","$97","$98}'
06/02/2014 12:02:59,0.158562,0.106358,3.061710,0.102991,38.801684,2.717995,0.003367,10.031008,0.343715,0,0,0,0,218,10,16,270,0,0,0,0,0,0,47,12,0,2,4,0,0,0
06/02/2014 12:05:22,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
06/02/2014 12:07:36,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
I would expect that the behaviour of both would be the same, and specifically that of the {FS=","} would be applied to the first line as well as all following lines.
The attached file is the head of the file I am using so you can test.
The version I am using is on kubuntu 13.10, the version information output is:
$ mawk -W version
mawk 1.3.3 Nov 1996, Copyright (C) Michael D. Brennan
compiled limits:
max NF 32767
sprintf buffer 2040
Please note that although I have awk in the example command lines above, it is pointing to mawk.
$ awk -W version
mawk 1.3.3 Nov 1996, Copyright (C) Michael D. Brennan
compiled limits:
max NF 32767
sprintf buffer 2040
$ readlink -f /usr/bin/awk
/usr/bin/mawk
$ |
|
2014-06-13 14:51:57 |
Greg Lutostanski |
mawk (Ubuntu): status |
New |
Won't Fix |
|