Profile picture Schedule a Meeting
c a n d l a n d . n e t

Sum a column in a tab-delimited file using Powershell

Dusty Candland | |

Assuming you have a bunch of tab delimited files w/out headers and the second column as a number, you could use the following powershell command to sum the values and output the result.

PS > $sum=0; ls | cat | %{ $.split(“`t”)[1] } | %{ $sum+=[int]$ }; $sum

Sample File:

a-count    7
b-count 233
c-count 32

Webmentions

These are webmentions via the IndieWeb and webmention.io. Mention this post from your site: