On Dec 15, 2012, at 1:06 PM, Andreas wrote:
> Hi,
>
> I need to import textfiles that have 5 columns but there is just blanks as
> delimitors.
> I could use COPY to read them but there is a time column that shows times as
> " h:mm.ss,ms" in the morning and "hh:mm.ss,ms" in the afternoon.
>
> P
On Sun, Dec 16, 2012 at 06:30:24PM -0500, Steve Clark wrote:
> why not use the squeeze option of tr.
>
> tr -s " "
I wasn't aware of that one, it's even simpler and more elegant.
Thanks!
For this particular case, tr(1) won't do for the same reason
the simple sed(1) expression I gave won't do: it
On 12/16/2012 01:12 PM, Peter Bex wrote:
On Sun, Dec 16, 2012 at 06:48:35PM +0100, Andreas wrote:
With sed as startingpoint I figured it out.
Those 3 steps make the input files consumable for COPY
1. dos2unix
2. sed -i 's/[ \t]*$//'
3. sed -i 's/ / /g'
You can reduce this to one invocation by
On Sun, Dec 16, 2012 at 06:48:35PM +0100, Andreas wrote:
> With sed as startingpoint I figured it out.
> Those 3 steps make the input files consumable for COPY
>
> 1. dos2unix
> 2. sed -i 's/[ \t]*$//'
> 3. sed -i 's/ / /g'
You can reduce this to one invocation by separating the commands
by a se
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
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.
Cheers,
Pe
On Sat, Dec 15, 2012 at 08:06:44PM +0100, Andreas wrote:
> Hi,
>
> Problem here is in the morning the first digit of the hour is shown as a
> blank so there are 2 blanks before the time so COPY misstakes this as an
> empty column and gets confused.
>
> Can someone point me in the direction of a
On 12/15/2012 11:06 AM, Andreas wrote:
Hi,
I need to import textfiles that have 5 columns but there is just blanks
as delimitors.
I could use COPY to read them but there is a time column that shows
times as " h:mm.ss,ms" in the morning and "hh:mm.ss,ms" in the afternoon.
Problem here is in the
Hi,
I need to import textfiles that have 5 columns but there is just blanks
as delimitors.
I could use COPY to read them but there is a time column that shows
times as " h:mm.ss,ms" in the morning and "hh:mm.ss,ms" in the afternoon.
Problem here is in the morning the first digit of the hour i