Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: data transformation

Re: data transformation

From: Mladen Gogala <mgogala.SPAM_ME.NOT_at_verizon.net>
Date: Wed, 14 Feb 2007 00:00:49 GMT
Message-ID: <RisAh.3829$2%1.2248@trndny02>


On Tue, 13 Feb 2007 17:44:27 -0500, Chris F.A. Johnson wrote:

> On 2007-02-13, m.t wrote:
>> I have log file with data like this:
>>
>> 20608694;20416953;20420430;20414156;20409061;20606877;20609113;20607051;20607052;20608204;
>> 20418197;20408410;20606460;20606462;20607297;20607356;20415876;20426551;20419862;20421635;
>>
>> Is there a way (Windows or Unix) to transform it to single column ?
>>
>> 20608694;
> ...
>> 20419862;
>> 20421635;
>
> sed -e 's/;/;\
> /g' < FILENAME > NEWFILENAME
>
> Or (POSIX shell):
>
> file=$( tr -d '\012' < ~/txt )
> set -f
> IFS=\;
> printf "%s;" $file
>

What a disgusting thing to write! You should be ashamed of yourself for writing things like that! There are also minors who read this group, think of them! In the state of New York, it is illegal to peddle POSIX shell, awk and sed to minors! This is how you write it:

$ perl -ne 'chomp; foreach $i (split /;/) { print "$i;\n"; }' log

20608694;
20416953;
20420430;
20414156;
20409061;
20606877;
20609113;
20607051;
20607052;
20608204;
20418197;
20408410;
20606460;
20606462;
20607297;
20607356;
20415876;
20426551;
20419862;
20421635;

The "log" argument is log file from the OP.

-- 
http://www.mladen-gogala.com
Received on Tue Feb 13 2007 - 18:00:49 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US