I want to get a part of a binary file, from byte #480161397 to #480170447 (included, 9051 bytes in total)
I use cut -b, and I expected the size of trunk1.gz to be 9051 bytes, but I get a different result.
$ wget https://commoncrawl.s3.amazonaws.com/crawl-data/CC-MAIN-2016-07/segments/1454701152097.59/warc/CC-MAIN-20160205193912-00264-ip-10-236-182-209.ec2.internal.warc.gz
$ cut -b480161397-480170447 CC-MAIN-20160205193912-00264-ip-10-236-182-209.ec2.internal.warc.gz >trunk1.gz
$ echo $((480170447-480161397+1))
9051
$ ls -l trunk1.gz
-rw-r--r-- 1 david staff 3400324 Sep 8 10:28 trunk1.gz
What is wrong?
wc -c trunk1.gz?cut -bwith some.gzfiles that I had as well. I also got file sizes larger than the bbytes specified. In normal files this can be explained by the fact that there are columns in the files. So the commandcut -bpicks out the corresponding bytes from each line. Hence large file sizes. i.e.cut -bis probably not what you need here.