  The focusing Nonlinear Schr\"odinger (NLS) equation is the simplest universal
model describing the modulation instability (MI) of quasi monochromatic waves
in weakly nonlinear media, and MI is considered the main physical mechanism for
the appearence of anomalous (rogue) waves (AWs) in nature. Using the finite gap
method, two of us (PGG and PMS) have recently solved, to leading order and in
terms of elementary functions of the initial data, the NLS Cauchy problem for
generic periodic initial perturbations of the unstable background solution of
NLS (what we call the Cauchy problem of the AWs), in the case of a finite
number of unstable modes. In this paper, concentrating on the simplest case of
a single unstable mode, we study the periodic Cauchy problem of the AWs for the
NLS equation perturbed by a linear loss or gain term. Using the finite gap
method and the theory of perturbations of soliton PDEs, we construct the proper
analytic model describing quantitatively how the solution evolves, after a
suitable transient, into slowly varying lower dimensional patterns (attractors)
in the $(x,t)$ plane, characterized by $\Delta X=L/2$ in the case of loss, and
by $\Delta X=0$ in the case of gain, where $\Delta X$ is the $x$-shift of the
position of the AW during the recurrence, and $L$ is the period. This process
is described, to leading order, in terms of elementary functions of the initial
data. Since dissipation can hardly be avoided in all natural phenomena
involving AWs, and since a small dissipation induces $O(1)$ effects on the
periodic AW dynamics, generating the slowly varying loss/gain attractors
analytically described in this paper, we expect that these attractors, together
with their generalizations corresponding to more unstable modes, will play a
basic role in the theory of periodic AWs in nature.
