[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ADD TO FAQ] : cut : using space as input delimiter
From: |
seb_kramm |
Subject: |
[ADD TO FAQ] : cut : using space as input delimiter |
Date: |
Tue, 11 Mar 2008 16:00:33 +0100 |
User-agent: |
Thunderbird 2.0.0.12 (Windows/20080213) |
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,
- [ADD TO FAQ] : cut : using space as input delimiter,
seb_kramm <=