grep -hc pattern files | perl -lpe '${_{_}}+=+${_}}{${_}+=+${_{_}}'