Pakistan's ousted Prime Minister, Imran Khan, has survived a gun attack during his recent long march in the eastern city of Wazirabad.