locked
Split a file based on it's contents? RRS feed

  • Question

  • In my data factory, I have a U-SQL script that generates a rather larger file.

    A small sample:

    "UA-1234", 1, 1, 2
    "UA-1234", 1, 2, 3
    "UA-5678", 5, 6, 7
    "UA-5678", 7, 8, 9
    "UA-1234", 3, 2, 3
    "UA-9876", 1, 2, 3

    What I'd like to do, given that sample, is split the file into smaller files based on the first column. So in this example, I'd end up with 3 files:

    UA-1234.csv:

    "UA-1234", 1, 1, 2
    "UA-1234", 1, 2, 3
    "UA-1234", 3, 2, 3

    UA-5678.csv:

    "UA-5678", 5, 6, 7
    "UA-5678", 7, 8, 9

    UA-9876.csv:

    "UA-9876", 1, 2, 3

    How should I approach this problem?

    Thanks,

    Matt

    Friday, March 25, 2016 2:04 PM

Answers