SSIS - Remove portion of field on text file import.

Below is a portion of a text file that I am trying to import to a SQL table from a comma delimited file.  I have two questions:

1) How do I get rid of the all of the text that prefixes each data value?  For example how do I strip off the 'cat=' and the 'cat_desc' when I import?
2) How can I import the second column as a single column, instead of having SSIS break the field at each comma embedded in the string?

cat=52,cat_desc="Desc01, Desc02",hostname=www.somehost.com
cat=34,cat_desc="Desc06, Desc03, Desc10",hostname=www.somehost.com
cat=52,cat_desc="Desc01, Desc02",hostname=www.somehost.com
cat=64,cat_desc="Desc64",hostname=www.somehost.com

Thanks for your help!
Chris
TriCoreITAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gothamiteCommented:
Can you run the following powershell snippet on the input file before it gets ingested to SSIS?
# pre-format data
$data=get-content data.txt
$out = @()
foreach ($line in $data)
{
    $out+=$line.Replace("cat=","`"").Replace(",cat_desc=","`",`"").Replace(",hostname=","`",`"").Replace("`"`"","`"")+"`""
}
$out | out-file data_out.txt
$out

Open in new window

0
TriCoreITAuthor Commented:
Thanks for the repsonse gothamite.  I was hoping to avoid a step outside of the SSIS environment, but will have to resort to this "pre-processing" if it cannot be done within SSIS.

Chris
0
Reza RadConsultant, TrainerCommented:
you can do it with SSIS,
just you need a Script Component Transformation after your flat file source.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
TriCoreITAuthor Commented:
a little more direction in terms of how to write the script would have been good.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.