Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8799779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:24:51+00:00 2026-06-14T00:24:51+00:00

I have a flat file that is pipe delimited and looks something like this

  • 0

I have a flat file that is pipe delimited and looks something like this as example

ColA|ColB|3*|Note1|Note2|Note3|2**|A1|A2|A3|B1|B2|B3

The first two columns are set and will always be there.

* denotes a count for how many repeating fields there will be following that count so Notes 1 2 3

** denotes a count for how many times a block of fields are repeated and there are always 3 fields in a block.

This is per row, so each row may have a different number of fields.

Hope that makes sense so far.

I’m trying to find the best way to parse this file, any suggestions would be great.

The goal at the end is to map all these fields into a few different files – data transformation. I’m actually doing all this within SSIS but figured the default components won’t be good enough so need to write own code.

UPDATE I’m essentially trying to read this like a source file and do some lookups and string manipulation to some of the fields in between and spit out several different files like in any normal file to file transformation SSIS package.

Using the above example, I may want to create a new file that ends up looking like this

“ColA”,”HardcodedString”,”Note1CRLFNote2CRLF”,”ColB”

And then another file

Row1: “ColA”,”A1″,”A2″,”A3″

Row2: “ColA”,”B1″,”B2″,”B3″

So I guess I’m after some ideas on how to parse this as well as storing the data in either Stacks or Lists or?? to play with and spit out later.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T00:24:53+00:00Added an answer on June 14, 2026 at 12:24 am

    One possibility would be to use a stack. First you split the line by the pipes.

    var stack = new Stack<string>(line.Split('|'));
    

    Then you pop the first two from the stack to get them out of the way.

    stack.Pop();
    stack.Pop();
    

    Then you parse the next element: 3* . For that you pop the next 3 items on the stack. With 2** you pop the next 2 x 3 = 6 items from the stack, and so on. You can stop as soon as the stack is empty.

    while (stack.Count > 0)
    {
        // Parse elements like 3*
    }
    

    Hope this is clear enough. I find this article very useful when it comes to String.Split().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a flat file that is pipe delimited and an database table. I
I have a flat file source from Excel that has a structure like this:
I have an array that is read from a flat file that looks like
Say I have a text file that looks like this: date 1/1/2010 a,b,c a,b,d
I have a tab delimited file on a shared path. I've setup that flat
I have a flat-file schema that has a header and detail records. It looks
My goal is to have a CMS that is totally self-contained like a flat-file
I have a pipe delimited flat file from which I need to deduplicate the
I have a windows mobile 5.0 application (smartphone) that contains a flat data file
I have to load a flat file that has different header and detail with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.