This topic contains 4 replies, has 3 voices, and was last updated by Andy Garlick 2 months, 1 week ago.

AuthorPosts

September 8, 2016 at 1:53 pm #53891
Hi All
so, not rally sure where to start with this... so please forgive the lack of any script
in short i have around 100 csv's in one location, all of them have the same headers. The only column i am interested in is column L "ItemCount".
in a perfect world i would like to total all cells in column L, create a new CSV with the file name of each CSV in one column then the result of the sum in another
Quick link to how excel file looks – http://s33.photobucket.com/user/markpriorgtst/media/Capture_3.jpg.html
As i say ideally i would like a file to look like
Column A Column B
APM01.csv 131
APM03.csv 131
ARD01.csv 1035
ARD03.csv 1035hoping someone can point me in the right direction, thanks

September 8, 2016 at 2:53 pm #53905
A little code golf for you.
gci *.csv  % {[pscustomobject]@{total = ((importcsv $_).numbers  measure Sum).sum;csv = $_.name}}

September 9, 2016 at 8:44 am #53959
Hi Dan
Legend !
gci "\\eurxmbs01\c$\tmpPFStats\*.csv"  % {[pscustomobject]@{total = ((importcsv $_).itemcount  measure Sum).sum;csv = $_.name}}
thanks
1518 ASPT01.csv
1518 ASPT03.csv
102852 APM01.csv
51426 APM03.csv
162 ARD01.csv
162 ARD03.csv 
June 7, 2017 at 6:59 pm #72320
I found this article and it helped me...Question – how can I add the Totals together?
So I have 10 CSV's – It is actually calculating a SUM of 1 Column in each CSV – It is outputting the correct figure and CSV File but I want a total of all Totals at the end? 
June 7, 2017 at 6:59 pm #72323
I found this article and it helped me...Question – how can I add the Totals together?
So I have 10 CSV's – It is actually calculating a SUM of 1 Column in each CSV – It is outputting the correct figure and CSV File but I want a total of all Totals at the end? 
AuthorPosts
You must be logged in to reply to this topic.