Specifying Record Delimiter

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • pankaj_wolfhunter@yahoo.co.in

    #1

    Specifying Record Delimiter

    Greetings,
    Some time back I got some good advice from this group.
    Again got stuck with something.

    I am using export utility to store data to flat files.

    For now I am using the following:

    EXPORT TO export_file_nam e OF DEL MODIFIED BY NOCHARDEL
    TIMESTAMPFORMAT =\"MMM DD YYYY HH:MM:SS:UUTT\" COLDEL# select query

    Can I change the default (newline) record delimiter to something of my
    own choice?

    Any help would be appreciated.

    TIA

  • Dave Hughes

    #2
    Re: Specifying Record Delimiter

    pankaj_wolfhunt er@yahoo.co.in wrote:
    Greetings,
    Some time back I got some good advice from this group.
    Again got stuck with something.
    >
    I am using export utility to store data to flat files.
    >
    For now I am using the following:
    >
    EXPORT TO export_file_nam e OF DEL MODIFIED BY NOCHARDEL
    TIMESTAMPFORMAT =\"MMM DD YYYY HH:MM:SS:UUTT\" COLDEL# select query
    >
    Can I change the default (newline) record delimiter to something of my
    own choice?
    As far as I can tell: no, you can't change the row delimiter (only the
    column and string delimiters). If you're on Linux you could always use
    the dos2unix / unix2dos utilities to convert the file afterward
    (sometimes these are called d2u or u2d). There's probably Windows
    versions of these too, somewhere.

    Alternatively you could write a quick script to handle the conversion.
    For example, under Python, the following would do the trick to convert
    to DOS (CRLF) line endings:

    input = open('export_fi le_name', 'rU')
    output = open('export_fi le_name.conv', 'w')
    for line in input:
    output.write(li ne.rstrip('\n') + '\r\n')


    HTH,

    Dave.

    --

    Comment

    • pankaj_wolfhunter@yahoo.co.in

      #3
      Re: Specifying Record Delimiter

      On Jul 23, 8:33 pm, "Dave Hughes" <d...@waveform. plus.comwrote:
      pankaj_wolfhun. ..@yahoo.co.in wrote:
      Greetings,
      Some time back I got some good advice from this group.
      Again got stuck with something.
      >
      I am using export utility to store data to flat files.
      >
      For now I am using the following:
      >
      EXPORT TO export_file_nam e OF DEL MODIFIED BY NOCHARDEL
      TIMESTAMPFORMAT =\"MMM DD YYYY HH:MM:SS:UUTT\" COLDEL# select query
      >
      Can I change the default (newline) record delimiter to something of my
      own choice?
      >
      As far as I can tell: no, you can't change the row delimiter (only the
      column and string delimiters). If you're on Linux you could always use
      the dos2unix / unix2dos utilities to convert the file afterward
      (sometimes these are called d2u or u2d). There's probably Windows
      versions of these too, somewhere.
      >
      Alternatively you could write a quick script to handle the conversion.
      For example, under Python, the following would do the trick to convert
      to DOS (CRLF) line endings:
      >
      input = open('export_fi le_name', 'rU')
      output = open('export_fi le_name.conv', 'w')
      for line in input:
      output.write(li ne.rstrip('\n') + '\r\n')
      >
      HTH,
      >
      Dave.
      >
      --
      Thanks Dave.
      Even I figured out after googling that we might not able to define a
      row delimiter.
      Just wanted to confirm. I already wrote a script on unix side to
      handle the conversion.
      Thanks again.

      Comment

      • Ray

        #4
        Re: Specifying Record Delimiter

        On Jul 23, 10:38 am, "pankaj_wolfhun ...@yahoo.co.in "
        <pankaj_wolfhun ...@yahoo.co.in wrote:
        On Jul 23, 8:33 pm, "Dave Hughes" <d...@waveform. plus.comwrote:
        >
        >
        >
        pankaj_wolfhun. ..@yahoo.co.in wrote:
        Greetings,
        Some time back I got some good advice from this group.
        Again got stuck with something.
        >
        I am using export utility to store data to flat files.
        >
        For now I am using the following:
        >
        EXPORT TO export_file_nam e OF DEL MODIFIED BY NOCHARDEL
        TIMESTAMPFORMAT =\"MMM DD YYYY HH:MM:SS:UUTT\" COLDEL# select query
        >
        Can I change the default (newline) record delimiter to something of my
        own choice?
        >
        As far as I can tell: no, you can't change the row delimiter (only the
        column and string delimiters). If you're on Linux you could always use
        the dos2unix / unix2dos utilities to convert the file afterward
        (sometimes these are called d2u or u2d). There's probably Windows
        versions of these too, somewhere.
        >
        Alternatively you could write a quick script to handle the conversion.
        For example, under Python, the following would do the trick to convert
        to DOS (CRLF) line endings:
        >
        input = open('export_fi le_name', 'rU')
        output = open('export_fi le_name.conv', 'w')
        for line in input:
        output.write(li ne.rstrip('\n') + '\r\n')
        >
        HTH,
        >
        Dave.
        >
        --
        >
        Thanks Dave.
        Even I figured out after googling that we might not able to define a
        row delimiter.
        Just wanted to confirm. I already wrote a script on unix side to
        handle the conversion.
        Thanks again.
        I highly recommend you get a good editor to use on the DOS side that
        can do all this stuff transparently. I use a Java-based editor called
        jEdit that has an FTP plugin that lets you treat FTP like another file
        system.

        Comment

        Working...