-1

I am reading the multiple clob data records from DB into file in UNIX using the shell scrpiting.

CLOB1:-

COUNTRY

AUSTR

CLOB2:-

ALIA

WON THE

CLOB3:-

WORLCUP

THRICE

Query fetched the clob like as below. When word is continued in next clob there is a single new line character(ex: between clob1 ending and clob2 starting) . When the word is not continued in the next clob there are 2 new line characters(ex:- between clob2 ending and clob3 starting).

Actual output after fetching the data from clob using select statement:-

COUNTRY

AUST

ALIA

WON THE

WORLCUP

THRICE

I want to modify the output file as per the below format. Can someone help me in this ?

COUNTRY

AUSTRALIA

WON THE

WORLDCUP

THRICE

shellter
  • 36,525
  • 7
  • 83
  • 90
  • What DB? Where are you going to recover the missing R in AUSTRALIA from? – 0xF Jul 30 '14 at 15:54
  • Sorry..Earlier it's a typo where R is missed. – sree kanth Jul 30 '14 at 16:09
  • Below are the statements called inside script. sqlplus -s $DATABASE << EOF >>CLOB3.txt select clob from testtable where country='AUSTRALIA'; exit; EOF – sree kanth Jul 30 '14 at 16:15
  • the script belongs in your question. Learn to use the `{}` formatting tool at the top left of the edit box. Select code to be formatted as then click `{}`, then Save your changes. Good luck. – shellter Jul 30 '14 at 18:17

1 Answers1

0

I assume you want to process the following file:

COUNTRY

AUSTR
ALIA

WON THE

WORLCUP

THRICE

to get:

COUNTRY
AUSTRALIA
WON THE
WORLCUP
THRICE

If so, use this command:

perl -lp00e 'y/\n//d' CLOB3.txt
0xF
  • 3,214
  • 1
  • 25
  • 29