Page 1 of 1

Formatting output of .csv file

Posted: Fri Jun 25, 2010 5:15 am
by stolireef
I have a large .csv file that I need to output to a very specifically formatted text file.
eg.
Column 1 (20 characters) Column 2 (11 Characters SSN) Column 3 (12 Characters Telephone)

Even if the text in the given string is either non-existant or shorter/longer than the number of characters specified, the string must either be shortened or lengthened to ensure that the columns are precisely as required.

I have no difficulty extracting the data and removing the comas however, from there,I can't seem to figure out how to format the output text file as noted above. Any help would be greatly appreciated.

BTW: I'm a big booster of Textpipe. It's allowed me to do some amazing things on large data sets. Thanks.

Re: Formatting output of .csv file

Posted: Fri Jun 25, 2010 6:44 am
by DataMystic Support
You need to adjust the spacing before removing the commas, using the Add\Force to Width filter.

e.g. for field 1, use

Restrict fields:1 Comma-delimited fields starting at field 1
+--Force to width 20

then do the same for fields 2-3, before finally removing commas.

Re: Formatting output of .csv file

Posted: Fri Jun 25, 2010 7:16 am
by stolireef
I was almost there and you gave me the last piece of the puzzle. Once again, nothing but good things to say about you and your program.

Re: Formatting output of .csv file

Posted: Fri Jun 25, 2010 8:54 am
by DataMystic Support
Thank you! Please tell your colleagues and friends about TextPipe!