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.
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.