However, if the decision to sell the shares and subsequently buy shares in the same company are discrete decisions, then the loss on the sale is able to be offset against other gains.
You would need to take certain steps to demonstrate the transactions are discrete, eg you could not do both transactions on the same day. I have done this once or twice. Since we are not talking about sheep stations it does not get challenged by the ATO.
However, if the ATO took the view that the transactions were for the purpose of washing a tax loss through, they would strike it down and assess you as if the sale never happened - Themcrazy stated.
Finally I would suggest that tax should not be the primary driver of any decision to buy or sell shares. It is an investment decision.