You can remove the "empty" REM-lines before sed'ing: grep -v "^REM *$" objects.sql | sed "s/REM //" | ... You need grep (or similar) for that (for example http://gnuwin32.sourceforge.net/packages/grep.htm = Grep for Windows) Seems to me you may want to look into cygwin OR change to Unix OR go the alternate route of Windows Script(ing) - http://www.microsoft.com/technet/scriptcenter/default.mspx HTH Michael Garfield Sørensen, CeDeT Quoting Mohammed Mehraj hussain <mhdmehraj@xxxxxxxxx>:
hi Michael , Here my scenario is also like that which you have mentioned bellow. this is my entry in the batch file . first we are creating the sql commands from a index file , and then we are formatting that index file by removing all the rem etc. imp system/manager file=emp.dmp fromuser=scott touser=hr indexfile=objects.sql log=objects.log 2>&1 | %TEE% -a %LOGFILE%rem -----------------------------------------------------------------------------rem format the objects.sql file to obj.sqlrem -----------------------------------------------------------------------------del obj.sql 2>&1 | %TEE% -a %LOGFILE% sed "s/REM //" objects.sql | sed "/rows/d" | sed -e "s/#.*//" -e "/^$/ d" |sed "s/CONNECT %OraSchemaOwner%//" | sed "1a spool obj.log" | sed "$a\ " | sed "$a\ spool off" | sed "$a\ exit;" >> obj.sql 2>&1 | %TEE% -a %LOGFILE% my case is in the index file a a command is created like the below one REM ALTER TABLE "HR"."EMPLOYEES" MODIFY ("DATE_TIME" DEFAULT REM sysdate REM REM REM REM ) ; REM ... 260000 rows it is formatting into ALTER TABLE "HR"."EMPLOYEES" MODIFY ("DATE_TIME" DEFAULT sysdate ) ; when this command runs ,it is comming like this ...
-- //www.freelists.org/webpage/oracle-l