Convert row with columns of data into column with multiple rows

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: Convert row with columns of data into column with multiple rows

#31 Post by dbenham » 06 Jul 2016 19:01

I've edited my original post with a full explanation.

SIMMS7400 wrote:I just tested it out and it works perfect! WOW!! Absolutely incredible! However, I do notice a difference in total number of lines between your solution & Antonio's.

If you are referring to the 6 column sample set that you provided, then it should yield identical results (it does for me).

But if you are talking about your 58 column input, then the most likely issue is commas within the values, and/or empty columns (two commas without any characters between them). Aacini's code cannot handle either of those situations. My code handles them just fine. Modifying pure batch to handle those cases is more difficult.


Dave Benham
Last edited by dbenham on 09 Jul 2016 08:44, edited 1 time in total.

SIMMS7400
Posts: 546
Joined: 07 Jan 2016 07:47

Re: Convert row with columns of data into column with multiple rows

#32 Post by SIMMS7400 » 07 Jul 2016 01:53

Hi Dave -

I didn't even think of that. As I just did a quick check, I should have 210015 rows.

Your code is revealing 210015 !!!! Antonio's code is off by about 10,0000.

Thank you both for help; this has made my life so much easier! I will be using both sets of codes whenever I can in the future as well. Thank you again!

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Convert row with columns of data into column with multiple rows

#33 Post by penpen » 09 Jul 2016 04:15

Squashman wrote:Hmm. So are you thinking a couple of FOR /L commands?
Yes, i thought of an endless for/l loop,
nearly the same as Aacinis solution (for /L instead of the for /F loop, so i don't post it).

Sorry i didn't have much time the last days.


penpen

Post Reply