Context. The origin of the variable component of the solar wind is of great intrinsic interest for heliophysics and spaceweather, e.g. the initiation of coronal mass ejections and the problem of mass loss of all stars. It is also related to the physics of coronal neutral sheets and streamers, which occur above lines of magnetic polarity reversal. Filaments and prominences correspond to the cool coronal component of these regions. Aims. We examine the dynamical behaviour of these structures where reconnection and dissipation of magnetic energy in the turbulent plasma are occurring. The link between the observed oscillatory motions and the eruption occurrence is investigated in detail for two different events. Methods. Two filaments were analysed using two different datasets: time series of spectra using a transition region line (He I at 584.33 Å) and a coronal line (Mg X at 609.79 Å) measured with CDS on-board SOHO, observed on May 30, 2003, and time series of intensity and velocity images from the NSO/Dunn Solar Telescope in the Hα line on September 18, 1994 for the other. The oscillatory content was investigated using Fourier transform and wavelet analysis and compared to different models. Results. In both filaments, oscillations are clearly observed, in intensity and velocity in the He I and Mg X lines, in velocity in Hα, with similar periods from a few minutes up to 80 min, with a main range from 20 to 30 min, simultaneously with eruptions. Both filaments exhibit vertical oscillating motions. For the filament observed in the UV (He I and Mg X lines), we provide evidence of damped velocity oscillations, and for the filament observed in the visible (Hα line), we provide evidence that parts of the filament are oscillating, while the filament is moving over the solar surface, before its disappearance.