Am 15.12.2012 22:22, schrieb Peter Bex:
On Sat, Dec 15, 2012 at 10:16:55PM +0100, Peter Bex wrote:
A simple sed(1) expression should do the trick:
sed -E 's/ +/ /g' old-file > new-file
I just remembered where I could check, and the GNU sed equivalent is:
sed -r 's/ +/ /g' old-file > new-file
Sorry for the confusion.
With sed as startingpoint I figured it out.
Those 3 steps make the input files consumable for COPY
- dos2unix
- sed -i 's/[ \t]*$//'
- sed -i 's/ / /g'
The input files get created by a simple windows batch where I can't change anything.
It uses echo to attach a line of 4 parameters to those textfiles.
How would you manage if one or more of those parameters contained blanks in some cases?
This doesn't appear, yet. But I consider this as luck. :}
The real column formats are ( TEXT, TEXT, DATE, TIME ).