Hi,

I have search about an hour on how to tell 'cut' to use space as input delimiter, finally found out alone ! Below is the question I was about to post, and the solution. I suggest adding this "trick" to the FAQ, or even to the manual.

Note: using MSW, this has been tested using gnuwin32 latest version

PROBLEM:
------------------------------------------------------------------
I have a generated numeric data file, to be plotted using gnuplot. The fields are separated with spaces. Before plotting, I need to do some basic line/text processing, using 'cut' and 'join'.

# data
1  1.1  1.3  1.4
2  1.2  1.5  1.6
...

Unfortunatly, I can't manage to use the space character as input separator for 'cut'. I read the coreutils FAQ, the manual (5.3.0), p.43, but I understand (and tried) that this is not possible.

Am I wrong ? Is there a way to do this ?
------------------------------------------------------------------
SOLUTION
Quote the whole 'd' option:

cut "--delimiter= " -f 2 file_in > file_out
or
cut "-d " -f 2 file_in > file_out

Another solution is using 'unexpand' to replace spaces by tabs

------------------------------------------------------------------


Regards,






_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to