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.
Formatting output of .csv file
Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators
- DataMystic Support
- Site Admin
- Posts: 2227
- Joined: Mon Jun 30, 2003 12:32 pm
- Location: Melbourne, Australia
- Contact:
Re: Formatting output of .csv file
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.
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
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.
- DataMystic Support
- Site Admin
- Posts: 2227
- Joined: Mon Jun 30, 2003 12:32 pm
- Location: Melbourne, Australia
- Contact:
Re: Formatting output of .csv file
Thank you! Please tell your colleagues and friends about TextPipe!