Hi All,
I have a list of files in unix. All the file names are in the format "somedate+abc.txt". eg 12062011abc.txt, 13062011abc.txt, 14062011abc.txt and so on.
I want to design a datastage job which will read these file NAMES and put the names (NOT CONTENTS) in a oracle table OR a comma seprated file.
One logic comes to my mind is, using ls command of unix and writing the output in a text file, then reading that file using sequence file stage. But i doubt how to delimit the file name properly so that I can read it later on.
Any Help or other logic
Thanks in advance.
Reading file names
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
... or even in the ls command itself. Let's imagine you're using an External Source stage. The command is something like
Code: Select all
cd $dirpath ; ls -1 [0-3][0-9][0-1][0-9][1-2][0-9][0-9][0-9][0-9]abc.txt
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Datastage
Thanks for your reply.
Let me clear my problem again.
Have some files like 01012011abc.txt, 02012011abc.txt, 03012011abc.txt, 04012011abc.txt and these files keep on increasing on daily bases. I Have a job which extracts the data from these files and put in a table.
Let say my first file have 5 records, and similarly other files have some records as well. Now I want to add a new column in my target tables which will represent against the record from which file it is coming.
Something like :-
Column 1 Column 2 Column 3 File Name
Abc 34 Ghk 01012011abc.txt
Gf 46 Rdty 01012011abc.txt
Gf 76 Jkl 01012011abc.txt
Gf 34 Dfgh 01012011abc.txt
Gf 57 Kj 01012011abc.txt
H 65 Ru 02012011abc.txt
Gf 56 Gfj 02012011abc.txt
Hg 43 Kj 02012011abc.txt
Gh 78 ter 02012011abc.txt
Let me clear my problem again.
Have some files like 01012011abc.txt, 02012011abc.txt, 03012011abc.txt, 04012011abc.txt and these files keep on increasing on daily bases. I Have a job which extracts the data from these files and put in a table.
Let say my first file have 5 records, and similarly other files have some records as well. Now I want to add a new column in my target tables which will represent against the record from which file it is coming.
Something like :-
Column 1 Column 2 Column 3 File Name
Abc 34 Ghk 01012011abc.txt
Gf 46 Rdty 01012011abc.txt
Gf 76 Jkl 01012011abc.txt
Gf 34 Dfgh 01012011abc.txt
Gf 57 Kj 01012011abc.txt
H 65 Ru 02012011abc.txt
Gf 56 Gfj 02012011abc.txt
Hg 43 Kj 02012011abc.txt
Gh 78 ter 02012011abc.txt
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
This is an entirely new problem. We gave solutions for the question you originally asked.
The new problem is solved completely differently, most probably by having the Sequential File stage generate a file name column.
The new problem is solved completely differently, most probably by having the Sequential File stage generate a file name column.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.