Core barrel is used for