SQL> spool rebuil.lst
SQL> select 'alter','index',index_name,'rebuild',';'
SQL> from dba_indexes where
SQL> owner='<OWNER NAME>' ;
SQL> spool off

open the "rebuild.lst" file

remove all the lines excepting those starting with "alter"
save the file as <filename>.sql

Now Run the file

SQL> @<filename>.sql