Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

External table with preprocessor file to show list of files

Mr.D.Jun 10 2014 — edited Jun 10 2014

Hi,

in my db 11.2.0.2 i would create a external table with preprocessor script to show me the list of file in a directory.

Preprocessor banally:

#!/bin/bash

cd /mydir

/bin/ls -l *.txt 2>/dev/null

The problem is that file name that contains whitespace (windows style in a Linux env), for ex:

-rw-r--r-- 1 oracle oinstall   920 Jun  9 17:37 File1.txt

-rw-r--r-- 1 oracle oinstall 72316 Jun 10 10:37 GC File output1.txt

-rw-r--r-- 1 oracle oinstall 72316 Jun 10 10:40 GC File output2.txt

So I cannot use FIELDS DELIMITED BY " ".

FIXED size? No because the filesize change the length of the rows.

I've tried to use awk in my preprocessos script but I've the same problem:


/bin/ls -l *.txt 2>/dev/null |/bin/awk '{printf "%s %.2d %s   %s\n", $6,$7,$8,$9}'


Any ideas?

This post has been answered by Mr.D. on Jun 10 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 8 2014
Added on Jun 10 2014
6 comments
2,614 views