Reputation: 1624
I have an .csv with four or five columns of data for webstats.
I analyzed the data with a program how I wanted to, and now I have a text file with a list of the pages I want and I'd like to delete all of the data for every page I don't need, so that only the ones from the text file remain.
i.e. If I have the .csv as follows:
/fruits-and-veggies/apples 16 3 03:43 .72%
/fruits-and-veggies/pears 8 2 02:34 .65%
/fruits-and-veggies/broccoli 6 5 04:23 .87%
/fruits-and-veggies/asparagus 46 6 01:23 .77%
/fruits-and-veggies/passion-fruit 36 7 05:53 .74%
And I have the text file as follows:
/fruits-and-veggies/apples
/fruits-and-veggies/pears
/fruits-and-veggies/passion-fruit
How do I manipulate the excel file so it only reads:
/fruits-and-veggies/apples 16 3 03:43 .72%
/fruits-and-veggies/pears 8 2 02:34 .65%
/fruits-and-veggies/passion-fruit 36 7 05:53 .74%
I've heavily researched this topic and have yet to come up with a viable solution. I'm using Windows XP, and batch files are favored if its possible, but I really don't know where start.
Upvotes: 0
Views: 242
Reputation: 2397
I work with complex table (csv) manipulations daily, and my work has been greatly eased by the amazing python petl library. Once you use this, there is no going back, and the author of the library is very helpful if you ever get stuck.
If you are not a programmer,don't worry - with even minimal scripting skills you can do amazing things with csv, text, json, and whatever is in table formats using petl.
Check out this video: https://www.youtube.com/watch?v=Y0FleNEcO9I
Library is here: http://petl.readthedocs.org/en/latest/
If you want to try and get stuck, ping me and I'll help you out.
Cheers,
PJ
Upvotes: 0
Reputation: 794
I would use python and its regular-expression module. It actually even has CSV module if I am not mistaken. There are many other ways / tools to do this.
Upvotes: 1