The Sensex opened with a small positive gap of six points at 7,931, and moved up to a high of 7,976 in early deals.
The index slipped into negative zone in noon deals after the government announced price hikes of petroleum products.
After hitting a low of 7,914 - down 62 points from the intra-day high - the index bounced back and closed with a gain of 22 points at 7,947.
The Nifty gained 13 points to close at 2,429.
The sectoral indices largely closed with gains. The BSE FMCG Index was up over a per cent (14 points) at 1,416. The BSE Teck index was up 0.4% (9 points) at 2,058. The BSE Bankex moved up 0.9% (40 points) to 4,561. The BSE Metal, Oil & Gas and Capital Goods indices closed marginally lower today.
The broad market was weak - out of 2,673 scrips traded, 1,498 declined, 1,134 advanced and 41 were unchanged today.
PSU oil scrips finished on a mixed note. HPCL moved up nearly 2% (Rs 6) to Rs 301. Gail added Rs 3 to Rs 240. Kochi Refineries was up a rupee at Rs 160. BPCL dropped over a per cent (Rs 4) to Rs 366. While ONGC was down Rs 6 at Rs 982, IOC declined Rs 2 to Rs 430.
SBI advanced 2.6% (Rs 21) to Rs 838, and ITC gained over 2% (Rs 37) to Rs 1,830.
Infosys was up Rs 8 at Rs 2,364, and Satyam moved up Rs 6 to Rs 531. TCS declined Rs 13 to Rs 1,398.
Cipla was firm right through the session, and closed with a gain of 2.7% (Rs 10) at Rs 365.
Bharti gained Rs 6 to Rs 325, and ICICI Bank was up Rs 4 at Rs 488.
Bajaj declined over a per cent (Rs 17) to Rs 1,470. ACC, HDFC, HLL, Hindalco, L&T and Maruti also declined.
SBI was the most active counter with a turnover of Rs 101 crore followed by Tata Steel (Rs 79 crore), Sterling Biotech (Rs 75 crore), Reliance (Rs 67 crore) and GTC Industries (Rs 64 crore).



