The transformation of a nonlinear wave in shallow water is investigated analytically and numerically within the framework of long-wave theory. It is shown that the nonlinearity parameter (the Mach number), which is defined as the ratio of the particle velocity in the wave to the propagation velocity, can be well above unity in a deep trough and that a jump appears initially in the trough. It is demonstrated that shockwave amplitudes at large times change in accordance with the prediction of weakly nonlinear theory. The shock front generates a reflected wave, which, in turn, transforms into a shock wave if the initial amplitude is large enough. The amplitude of the reflected wave is proportional to the cube of the initial amplitude (as predicted by weakly nonlinear theory) over a wide range of amplitudes except for the case of anomalously strong nonlinearity. When there is a sign-variable sufficiently intense initial perturbation, the basic wave transforms into a positive shock pulse (crest) and the reflected wave turns into a negative pulse (trough).