# How to calculate the sum of bytes in a column?

I have this table below, how can I calculate the sum of bytes for records in Nov only? for example below I want to find rows in Nov then sum the numbers in column4 relevant to Nov only? how I can do it?

``````1 arnold   user   1933 Nov  7 13:05
2 megan   user  10809 Nov  7 13:03
3 sam   user    983 Apr 13 12:14
4 mark   user  31869 Jun 15 12:20
5 sandy   user  22414 Nov  7 13:03
6 semon   user  37455 Nov  7 13:03
7 andre   user  27511 Dec  9 13:07
8 jim   user   7989 Nov  7 13:03
``````

You can try `awk` as follows:

``````awk '\$5 == "Nov" { sum += \$4 }END { print sum }'  file
80600
``````

\$5 represent the column relevant to months. `\$5 == "Nov"` will filter the table for all records in November, then `awk` will sum the numbers in column \$4

Using awk:

``````awk 'BEGIN {sum = 0}
\$5 == "Nov" {sum += \$4}
END {print sum}' < data
``````

where `data` is your file containing the record.

To enable you to change the target month simply, try summing all months in an array, and print the relevant array element only:

``````awk '{SUM[\$5] += \$4} END {print SUM["Nov"]}' file
80600
``````
{"ft_lang_label":"__label__en","ft_lang_prob":0.8446127,"math_prob":0.760797,"size":444,"snap":"2019-35-2019-39","text_gpt3_token_len":162,"char_repetition_ratio":0.175,"word_repetition_ratio":0.0,"special_character_ratio":0.4436937,"punctuation_ratio":0.10084034,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.97964114,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-09-19T00:16:04Z\",\"WARC-Record-ID\":\"<urn:uuid:30a3693f-1f4b-483a-9b52-f7ab087f17e9>\",\"Content-Length\":\"143830\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:b31c67b8-7a66-4378-88d3-c38040a1f05d>\",\"WARC-Concurrent-To\":\"<urn:uuid:b18cd200-f833-4587-b831-6113a9eaa2b8>\",\"WARC-IP-Address\":\"151.101.65.69\",\"WARC-Target-URI\":\"https://unix.stackexchange.com/questions/473791/how-to-calculate-the-sum-of-bytes-in-a-column\",\"WARC-Payload-Digest\":\"sha1:L6IEBCCZJG54SKPWQYJXZWMHQ2EA62Y4\",\"WARC-Block-Digest\":\"sha1:ONAPN27X4H4BH3GUDG2ZO2H5ZDVJQXJY\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-39/CC-MAIN-2019-39_segments_1568514573385.29_warc_CC-MAIN-20190918234431-20190919020431-00133.warc.gz\"}"}