Results 1 to 4 of 4

Thread: Loading CSV flat file into target - informatica

  1. #1
    Senior Member vijay's Avatar
    Join Date
    May 2012
    Location
    Hyderabad
    Posts
    514

    Loading CSV flat file into target - informatica

    I have flat file (which is separated by comma) and has the following columns

    Code:
    Col1,    col2,      col3,                             col4
    ------------------------------------------------
    Davan,  100  ,   #32,mathahalli,Bangalore, 100000
    Hari ,    200  ,   #32,marthahalli,Bagalore,  200000

    But in 3rd column we have address which is separated again by comma. How can we load the data into target .with the use of only informatica?

    I dont want to use any unix script for changing the format of the file. Everything should be handled in informatica.

  2. #2
    Member
    Join Date
    Oct 2012
    Posts
    63
    Blog Entries
    1
    I think its better to use the unix commands and double quote the col3 and then read the data from the file.

    If the file is fixed width, then go for fixed width flat file instead of delimited one.

  3. #3
    Junior Member
    Join Date
    Jun 2013
    Posts
    1

    Loading CSV flat file into target - informatica

    Quote Originally Posted by Nandan View Post
    I think its better to use the unix commands and double quote the col3 and then read the data from the file.

    If the file is fixed width, then go for fixed width flat file instead of delimited one.
    Hello dear,
    can you please explain how the solution will be with UNIX?

    thanks in advance

  4. #4
    Member
    Join Date
    Oct 2012
    Posts
    63
    Blog Entries
    1
    Run the following awk command:

    Code:
    awk -F',' 'BEGIN {OFS=","} {a=4;n=NF;e=3;h=n-(e-1)-(a-e);s="\""; for(i=e;i<=h+e-1;i++){s=s$i",";$i=""; } ;i=i-1;s=s"\"";$i=s; gsub (/,+/,",",$0);print $0}' filename
    The variable a indicates the actual columns in the file. n indicates the number of fields in the file because of the delimiter. e is the position of the address field.

Similar Threads

  1. Replies: 2
    Last Post: 12-02-2013, 10:29 AM
  2. Replies: 1
    Last Post: 07-24-2012, 08:18 AM
  3. Replies: 2
    Last Post: 07-18-2012, 07:37 AM
  4. Replies: 3
    Last Post: 05-28-2012, 03:04 PM
  5. Replies: 3
    Last Post: 05-25-2012, 10:29 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •