FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   Add to FavoritesAdd to Favorites
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    RSS Get RSS Feed  


Combine two different csv files into one

 
Post new topic   Reply to topic    Macro Scheduler and Windows Automation Forum Index -> Beginners
View previous topic :: View next topic  
Author Message
TS
Newbie


Joined: 05 Feb 2010
Posts: 4

Reputation: 100
Earn Points, Win a T-Shirt

PostPosted: Sat Feb 06, 2010 11:03 pm    Post subject: Combine two different csv files into one Reply with quote

or add the content of one csv file into the next one.

I am sure this has been discussed already:

- I have tables from different webpages, which I received using table2clipboard (Thanks and greetings to Bob Hansen, here.)
- now they need to be added to an existing csv-file format, despite that they have different headers

This is actually a request for the basic handling of columns in csv files - avoiding Excel. Some columns need to be combined into one (like a; f; c; k; l; m etc.), others must be erased. It would not matter, to change the header directly in that finished file or to write into an existing one.

Any hints or links here welcome.

Did this message help you? If so please reward the poster with Reputation Points? Reward Points
Back to top
View user's profile Send private message
JRL
Automation Wizard


Joined: 10 Jan 2005
Posts: 1804
Location: Iowa
Reputation: 525.9
votes: 45
Earn Points, Win a T-Shirt

PostPosted: Sun Feb 07, 2010 5:27 am    Post subject: Reply with quote

A good place to start might be SQL. Marcus has posted several great blogs about creating and modifying CSV files using SQL.

Look HERE for some possibilities.

Did this message help you? If so please reward the poster with Reputation Points? Reward Points
Back to top
View user's profile Send private message
Bob Hansen
Automation Wizard


Joined: 24 Sep 2002
Posts: 2414
Location: Salem, New Hampshire, US
Reputation: 300
votes: 17
Earn Points, Win a T-Shirt

PostPosted: Sun Feb 07, 2010 11:33 pm    Post subject: Reply with quote

Have you considered using RegEx> ?

Can you provide a sample of some lines before parsing and desired results after?
_________________
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Did this message help you? If so please reward the poster with Reputation Points? Reward Points
Back to top
View user's profile Send private message Visit poster's website
TS
Newbie


Joined: 05 Feb 2010
Posts: 4

Reputation: 100
Earn Points, Win a T-Shirt

PostPosted: Mon Feb 08, 2010 1:42 pm    Post subject: Some lines Reply with quote

Well, this makes a rather difficult read I suppose or can one add an attachment, which I haven`t found out so far?
To answer the question, no I had not considered RegEx so far, since I mainly need to shift whole columnes. At least in this very first table. But having had a closer look at the next tables, I found out I might should do so, since one these tables has all the information (address of customer and order) crammed into a single field, divided only by headwords, so to speak.



item-name listing-id sku price shipping-fee quantity-purchased total-price purchase-date batch-id buyer-email buyer-name
Selbstwert und Kommunikation. Familientherapie für Berater und zur Selbsthilfe 0113G0I7X8V PSY1006N 8 3 1 11 30.01.2010 10:31:37 Europe/Berlin test@web.de Donald Duck
Pustekuchen! Lauter kulinarische Wortgeschichten [Taschenbuch] by Gutknecht... 1117EU2DW61 BEL62029N 2,2 3 1 5,2 30.01.2010 11:39:39 Europe/Berlin test@nihk.de Donald Duck
Der große Schlaf [Taschenbuch] by Chandler, Raymond; Ortlepp, Gunar 0113G0I7C0P KRI9701N 0,85 3 1 3,85 30.01.2010 18:16:23 Europe/Berlin test@web.de Donald Duck


Artikel Gesamtsumme der Bestellung E-Mail-Adresse des Käufers Kunde
Autor: Herman-Friede, Eugen Titel: Für Freudensprünge keine Zeit Erinnerungen an Illegalität und Aufbegehren 1942-1948 EUR 3,95 test@aol.com Marcus PilarskiVVN-BdA e.V.
Autor: Titel: Schleswig-Holsteinischer Heimatkalender 1966 EUR 5,50 test@web.de christiane bösche
Autor: Bongiorni, Sara Titel: Ein Jahr ohne Made in China EUR 14,00 test@golbs.com Christian Golbs

Did this message help you? If so please reward the poster with Reputation Points? Reward Points
Back to top
View user's profile Send private message
Bob Hansen
Automation Wizard


Joined: 24 Sep 2002
Posts: 2414
Location: Salem, New Hampshire, US
Reputation: 300
votes: 17
Earn Points, Win a T-Shirt

PostPosted: Tue Feb 09, 2010 1:50 am    Post subject: Reply with quote

I was hoping to see a BEFORE and AFTER example showing the same data. The two "paragraphs" in the previous posting do not appear to be that.

If the info above is data in columns, what is the delimiter between the columns? Is it a Tab or s SPACE char or something else? Can you use another character like "_" or "~" if the forum has trouble displaying them? Display it in both the BEFORE and AFTER examples.
_________________
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Did this message help you? If so please reward the poster with Reputation Points? Reward Points
Back to top
View user's profile Send private message Visit poster's website
TS
Newbie


Joined: 05 Feb 2010
Posts: 4

Reputation: 100
Earn Points, Win a T-Shirt

PostPosted: Tue Feb 09, 2010 5:29 pm    Post subject: Reply with quote

ZVAB Bestellnr.~Bestelleingang~Artikel

5789047~8. Februar 2010 00:25:44~Autor: Herman-Friede, Eugen Titel: Für Freudensprünge

5787952~7. Februar 2010 18:39:32~Autor: Titel: Schleswig-Holsteinischer

This is the header of the file to be imported, the delimiter is TAB, which I have replace with ~. I inserted empty lines to make it more obvious, where each line starts and ends. They are in columns, which I have shortened to explain how each file is built.

The first file looks very much the same, delimiter is also TAB. Thanks for any hint how to best tackle this one.

Did this message help you? If so please reward the poster with Reputation Points? Reward Points
Back to top
View user's profile Send private message
Bob Hansen
Automation Wizard


Joined: 24 Sep 2002
Posts: 2414
Location: Salem, New Hampshire, US
Reputation: 300
votes: 17
Earn Points, Win a T-Shirt

PostPosted: Tue Feb 09, 2010 6:46 pm    Post subject: Reply with quote

Still trying to clarify your needs:

Is this correct (using "~" for tabs)?

File 1:
ID~Date~Author~Publisher~Subject~Pages
123~12/27/1988~Fred~MacMillan~History~356
2345~02/13/2003~Mary~O'Reilly~Computers~87

File 2:
ID~Date~Pages~Subject:Author
437~07/23/2001~55~Marketing:Sally

Need to modify File 2 to have format like File 1 and append to the end of File 1?
---------------------------------------------
If yes, then we can use RegEx to move the positions of the File 2 data, and insert blank field as needed for the missing Publisher to make it the same format as File 1. Then just append File2 to File 1.

If No, then still need clarification of the problem.
_________________
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Did this message help you? If so please reward the poster with Reputation Points? Reward Points
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:    View previous topic :: View next topic  
Post new topic   Reply to topic    Macro Scheduler and Windows Automation Forum Index -> Beginners All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group