{"id":25096610,"url":"https://github.com/jceb/summer","last_synced_at":"2025-04-02T02:14:18.952Z","repository":{"id":18109256,"uuid":"21179026","full_name":"jceb/summer","owner":"jceb","description":"Sum values in column and print result","archived":false,"fork":false,"pushed_at":"2017-02-11T11:47:07.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-22T21:02:21.859Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"wx-chevalier/Distributed-Infrastructure-Series","license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jceb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-24T20:04:37.000Z","updated_at":"2017-02-11T11:47:09.000Z","dependencies_parsed_at":"2022-07-13T05:40:33.831Z","dependency_job_id":null,"html_url":"https://github.com/jceb/summer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jceb%2Fsummer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jceb%2Fsummer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jceb%2Fsummer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jceb%2Fsummer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jceb","download_url":"https://codeload.github.com/jceb/summer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246741119,"owners_count":20826066,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-07T16:49:06.072Z","updated_at":"2025-04-02T02:14:18.934Z","avatar_url":"https://github.com/jceb.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"summer\n======\n\n\u003cpre\u003e\nUsage of summer:\n\tSum values in column and print result\nOptions:\n  -f 1  --field=1     Selected field\n  -d    --delimiter=  Use delimiter instead of space-like characters\n  -n    --no-print    Don't print input\n  -p    --print       Print input\n  -s 2  --scale=2     Scale to number of digits after the decimal point\n        --help        show usage message\n\u003c/pre\u003e\n\n## Installation\n\nInstall [go](http://golang.org) and run the following command:\n\u003cpre\u003e\n\u0026gt; go get github.com/jceb/summer\n\u003c/pre\u003e\n\nThe summer command should now be available.\n\n## Examples\n\nConsider this file containing multiple fields, semi aligned with spaces and tabs\nand having a semicolon as separator as well:\n\n\u003cpre\u003e\nNum     Time   IsoTime  Other Separator\n1 \t    2h3m   3:01     ; 4\n2 \t    3h4m   2:01     ; 4\n-3.5 \t4h5m   4:01     ; 4\n4.3 \t5h6m   8:01     ; 4\n5 \t    6h7m   3:01     ; 4\nfoo     bar             ; 4\n6.765 \t7h8m   3:01     ; 4\n7 \t    8h9m   3:01     ; 4\n8 \t    9h10m  3:01     ; 4\n9 \t    10h11m 3:01     ; 4\n10\t    11h12m 12:01    ; 4\n11\t    12h13m 33:01:01    ; 4\n12\t    13h14m 3:01     ; 4\n\u003c/pre\u003e\n\nWhat if you wanted to figure out the sums of the different columns?\n\nExecuting the summer command will sum the selected column.  The input will be\nprinted as well to make easy to select these lines in vim and retrieve the\nresult in an additional line below the selection.\n\n### Let's sum the first column\n\n\u003cpre\u003e\n\u0026gt; summer \u0026lt; FILE\nNum     Time   IsoTime  Other Separator\n1 \t    2h3m   3:01     ; 4\n2 \t    3h4m   2:01     ; 4\n-3.5 \t4h5m   4:01     ; 4\n4.3 \t5h6m   8:01     ; 4\n5 \t    6h7m   3:01     ; 4\nfoo     bar             ; 4\n6.765 \t7h8m   3:01     ; 4\n7 \t    8h9m   3:01     ; 4\n8 \t    9h10m  3:01     ; 4\n9 \t    10h11m 3:01     ; 4\n10\t    11h12m 12:01    ; 4\n11\t    12h13m 33:01:3600    ; 4\n12\t    13h14m 3:01     ; 4\n72.57\n\u003c/pre\u003e\nThe result is 72.57.\n\n### Let's sum the third column without printing the input\n\n\u003cpre\u003e\n\u0026gt; summer -f 3 -n \u0026lt; FILE\n80h12m1s\n\u003c/pre\u003e\nThe result is 80h12m1s.\n\n### Let's sum the fourth column\n\n\u003cpre\u003e\n\u0026gt; summer -f 4 -n \u0026lt; FILE\n4.00\n\u003c/pre\u003e\nWait, the result is 4.00.  Shouldn't it be much higher?\n\n### Let's sum the fourth (second) column by changing the separator\n\n\u003cpre\u003e\n\u0026gt; summer -f 2 -n -d \\; \u0026lt; FILE\n52.00\n\u003c/pre\u003e\nThis looks much better.  The result is 52.00.\n\n## Todo\n\n* Make line separator cross platform, function SumString\n* Support binary, octal and hex and values\n* Support negative fields that are counted from the right\n* Return a proper error code when values couldn't be parsed\n* Improve output of time values\n\n# Done\n* Add examples, 2014-07-06\n* Support time values exceeding 24 hours, 2014-07-06\n* Support negative times in -3:04 format, 2014-07-06\n* Support summing time durations like 2:03, 2014-07-06\n* Support summing time durations like 2hm3, 2014-07-06\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjceb%2Fsummer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjceb%2Fsummer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjceb%2Fsummer/lists"}