We have observed several emission lines of two Nitrogen-bearing (C
2H
5CN and C
2H
3CN) and two Oxygen-bearing (CH
3OCH
3 and HCOOCH
3) molecules towards a sample of well-known hot molecular cores (HMCs) in order to check whether the chemical differentiation seen in the Orion-HMC and W3(H
2O) between O- and N-bearing molecules is a general property of HMCs. With the IRAM-30m telescope we have observed 12 HMCs in 21 bands, centered at frequencies from 86250 to 258280MHz. In six sources, we have detected a number of transitions sufficient to derive their main physical properties. The rotational temperatures obtained from C
2H
5CN, C
2H
3CN and CH
3OCH
3 range from ∼100 to ∼150K in these HMCs. The total column densities of these molecules are of the order of ∼10
15-10
17cm
–2. Single Gaussian fits performed to unblended lines show a marginal difference in the line peak velocities of the C
2H
5CN and CH
3OCH
3 lines, indicating a possible spatial separation between the region traced by the two molecules. On the other hand, neither the linewidths nor the rotational temperatures and column densities confirm such a result. The average molecular abundances of C
2H
5CN, C
2H
3CN and CH
3OCH
3 are in the range ∼10
–9-10
–10, comparable to those seen in the Orion hot core. In other HMCs Bisschop et al.
2007A&A...465..913B found comparable values for C
2H
5CN but values ∼2.5 times larger for CH
3OCH
3. By comparing the abundance ratio of the pair C
2H
5CN/C
2H
3CN with the predictions of theoretical models, we derive that the age of our cores ranges between 3.7 and 5.9x10
4yr. The abundances of C
2H
5CN and C
2H
3CN are strongly correlated, as expected from theory which predicts that C
2H
3CN is formed through gas phase reactions involving C
2H
5CN . A correlation is also found between the abundances of C
2H
5CN and CH
3OCH
3, and C
2H
3CN and CH
3OCH
3. In all tracers the fractional abundances increase with the H
2 column density while they are not correlated with the gas temperature. On average, the chemical and physical differentiation between O- and N-bearing molecules seen in Orion and W3(H
2O) is not revealed by our observations. We believe that this is partly due to the poor angular resolution of our data, which allows us to derive only average values over the sources of the discussed parameters.