rearrange columns in csv file
Moderators: chulett, rschirm, roy
rearrange columns in csv file
HI
I have a question
i have few csv file in my server and the columns changes very day and file to file.
like for example for invoice1.csv columns are:
Invoice number, customer_id, Valid_from, Valid_to, extraction_time,user_code,emp_id
and second file invoice2.csv columns are:
extraction_time,user_code,emp_id,Invoice number,customer_id, Valid_from, Valid_to.
And i need the file to be some order like:
Invoice number, customer_id,user_code,Valid_from, Valid_to,extraction_time,
emp_id. for datastage or lets say the order in which i want the columns to be.
Can Any one suggest me an idea
I have a question
i have few csv file in my server and the columns changes very day and file to file.
like for example for invoice1.csv columns are:
Invoice number, customer_id, Valid_from, Valid_to, extraction_time,user_code,emp_id
and second file invoice2.csv columns are:
extraction_time,user_code,emp_id,Invoice number,customer_id, Valid_from, Valid_to.
And i need the file to be some order like:
Invoice number, customer_id,user_code,Valid_from, Valid_to,extraction_time,
emp_id. for datastage or lets say the order in which i want the columns to be.
Can Any one suggest me an idea
-
- Premium Member
- Posts: 783
- Joined: Mon Jan 16, 2006 10:17 pm
- Location: Sydney, Australia
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
If it's always the same six fields the first thing I'd be doing is getting the provider of the file to be consistent.
If you can't do that, you need to determine which column is which. If there are column headings this ought to be easy. In a Transformer stage you could use RCP to direct the correct columns to the output link.
If you can't do that, you need to determine which column is which. If there are column headings this ought to be easy. In a Transformer stage you could use RCP to direct the correct columns to the output link.
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.
Yes It is same six fields and column names are in first line.ray.wurlod wrote:If it's always the same six fields the first thing I'd be doing is getting the provider of the file to be consistent.
If you can't do that, you need to determine which column is which. If there are column headings this ought to be easy. In a Transformer stage you could use RCP to direct the correct columns to the output link.
Yes It is same six fields and column names are in first line.ray.wurlod wrote:If it's always the same six fields the first thing I'd be doing is getting the provider of the file to be consistent.
If you can't do that, you need to determine which column is which. If there are column headings this ought to be easy. In a Transformer stage you could use RCP to direct the correct columns to the output link.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: