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: Help!! How to remove new line Character from spooled output??

Re: Help!! How to remove new line Character from spooled output??

From: Mike Krolewski <mkrolewski_at_rii.com>
Date: Wed, 27 Dec 2000 15:17:40 GMT
Message-ID: <92d16f$c54$1@nnrp1.deja.com>

In article <915bsk$cfj$1_at_nnrp1.deja.com>,   Head_Cheese_mmmm <head_cheese_mmmm_at_my-deja.com> wrote:
> I am having a hell of a time getting SQL+ to drop the new line
> Character from my spool file. I can't see the Character in vi but it
 is
> there because my script output is 8k but the file size is 9k. The
> script I have written is simple it just calculates the last EOM from
> dual and writes that to a spool file. Several days later a UNIX batch
> file wakes up to read tha date and process the EOM Data, the problem
 is
> that it expects 8k not 9k. Here is the script:
>
> SET TRIMS ON
> SET PAGESIZE 0
> SET EMBEDDED OFF
> SET HEADS OFF
> SET NEWP NONE
> SET HEADING OFF
> SET ECHO OFF
> SET FEEDBACK OFF
> SET LIN 8
> SET SPACE 0
> SET RECSEP OFF
>
> SPOOL $DATA_DIR/sysctl.asc
> SELECT TO_CHAR(LAST_DAY(ADD_MONTHS(SYSDATE,-1)),'YYYYMMDD') FROM
 DUAL
> /
> SPOOL OFF
>
> EXIT
>
> How do I get rid of the 1k new line Character?????
>
> What I don't understand is the "SET PAGESIZE 0" should "supress all
> headings, pagebreaks,titles,the initial blank line,and other
 formatting
> information ." according to the SQL+ manaual. The O/S is Sun 2.6 and
> the Oracle is 8.01 if it matters.....
>
> TIA
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>

The PC is generating \r\n at the end of each line. There is no way to remove this from the SQLPlus output. You can add additional line or other symbols.

vi on the PC probably will not see this.

This problem is one of the most common problems in moving files from the PC to unix and/or back.

The most obvious idea is to cleanup the file under unix. Sed is the simplist choice.

Off the top of my head,

     sed 's/\r//' <file> |

could be used instead of the file name. You could also use sed to preprocess the file prior to calling it in the unix script.

If you are using perl, you can do the substitution when you are reading in the line in the file.

--
Michael Krolewski
Rosetta Inpharmatics
mkrolewski_at_rii.com
              Usual disclaimers


Sent via Deja.com
http://www.deja.com/
Received on Wed Dec 27 2000 - 09:17:40 CST

Original text of this message

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