array = ArrayReshape[Range[5 17], {5, 17}]; // after kglr
Transpose[Transpose[array.DiagonalMatrix[{0, 1, 1, 1, 1, 1, 0}]].DiagonalMatrix[{0, 1,
1, 1, 0}]] // MatrixForm
Or, more generally:
array // Transpose[Transpose[#.SparseArray[{{1, 1} -> 0,
ConstantArray[Dimensions[#][[2]], 2] -> 0, Band[{1, 1}] -> 1},
Dimensions[#][[2]]]].SparseArray[{{1, 1} -> 0,
ConstantArray[Dimensions[#][[1]], 2] -> 0, Band[{1, 1}] -> 1},
Dimensions[#][[1]]]] & // MatrixForm
$\left(
\begin{array}{ccccccc}
0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 9 & 10 & 11 & 12 & 13 & 0 \\
0 & 16 & 17 & 18 & 19 & 20 & 0 \\
0 & 23 & 24 & 25 & 26 & 27 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 \\
\end{array}
\right)$
ReplacePart
. Also, it's good practice to include self contained examples -- in this case your initialisation ofmat
is missing. $\endgroup$