Re: CTRL-M Problem

  • From: Wayne Bastow <ayu.njoman@xxxxxxxxx>
  • To: Jared Still <jkstill@xxxxxxxxx>
  • Date: Thu, 9 Dec 2004 08:15:27 +1100

Jared,

I tried your suggestion (and the others)  but I still get no joy.
Maybe I haven't explained properly. The following is one field (but it
is output to 5 seperate lines) from the dump from Sybase:

Separate and freeze serum. Wrap in foil to protect from light.~Collect
on ice .^M
Must be kept in dark. ^M
Wrap specimen in aluminium foil.^M
Send to Pathology ASAP. ^M
DO NOT COLLECT IN A GEL TUBE.

What I'm trying to do is end up with (all on the same line):

Separate and freeze serum. Wrap in foil to protect from light.~Collect
on ice .<br>Must be kept in dark.<br>Wrap specimen in aluminium
foil.<br>Send to Pathology ASAP. <br>DO NOT COLLECT IN A GEL TUBE.

Thanks,
Wayne

On Wed, 8 Dec 2004 06:18:28 -0800, Jared Still <jkstill@xxxxxxxxx> wrote:
> The following one liner will remove CR from a CR/LF pair.
> It does not require the literal ^M, as it uses whatever
> '/r' is defined as on the current platform.
> 
>  perl -pe "s/\r//g" -i.bak <filename>
> 
> 
> 
> 
> On Wed, 8 Dec 2004 01:34:18 -0500, Mark W. Farnham <mwf@xxxxxxxx> wrote:
> > Try replacing ^M^J with your tag.
> >
> >
> >
> > -----Original Message-----
> > From: oracle-l-bounce@xxxxxxxxxxxxx
> > [mailto:oracle-l-bounce@xxxxxxxxxxxxx]On Behalf Of Wayne Bastow
> > Sent: Tuesday, December 07, 2004 10:11 PM
> > To: oracle-l@xxxxxxxxxxxxx
> > Subject: CTRL-M Problem
> >
> > Hi,
> >
> > I'm moving some tables from Sybase to Oracle (9i). I can dump the data
> > out from Sybase into files using ~ as the field seperator and <CR> for
> > the record end. The problem I have is that some of the fields have ^M
> > in them. I have used sed to replace the ^M's with <br> html tag (The
> > data ends up in Oracle and is accessed using PHP via a browser). The
> > problem is that there is still a <CR> after the <br> tag meaning that
> > sqlldr has trouble loading these records. I have tried sed
> > s/^M$/\<br\>/g without luck. An example record which causes problems
> > looks like:
> >
> > 3~5HIAA 24 Hr Urine
> >            ~U5HIAAT                                           ~~St
> > Vincent's~Biochemistry                                      ~Note UVOL
> > and  pH on request form. Aliquot 100mls send refrigerated.  Acid
> > bottles (30ml 60% HCl) required for collection.~Urine container is
> > available from Pathology Ext 3223. Please provide details of current
> > medications.^M
> > Dietary instructions:  for at least 12 hours prior to and during
> > collection of 24 hour urine, avoid consuming the following - avocados,
> > bananas, pineapples, plums, tomatoes, nuts, chocolate, eggplant,
> > kiwifruit, figs, grapes.  These foods contain chemicals which may
> > interfere with laboratory testing.~10 days~~WD   ~E   ~~7~~~~~~
> >
> > Using the above sed gives me ^M replaced by <br> but it still has the
> > <CR> in it meaning that sqlldr sees it as two lines.
> >
> > Anyone sorted this one out before?
> >
> > Thanks,
> > Wayne
> > --
> > //www.freelists.org/webpage/oracle-l
> > 
> > --
> 
> 
> > //www.freelists.org/webpage/oracle-l
> >
> 
> 
> --
> Jared Still
> Certifiable Oracle DBA and Part Time Perl Evangelist
>
--
//www.freelists.org/webpage/oracle-l

Other related posts: