At least 23 militants and 7 civilians have been killed in northwest Pakistan in attacks on rebels hideouts, a checkpoint clash and a motorcycle bombing.