Hello,
I'm trying to modify a spooled file.
This is the example:
12:32:46 SQL > spool test1.sql
12:32:52 SQL > select 123 from dual;
123
----------
123
Elapsed: 00:00:00.01
12:33:03 SQL > spool off
Then I'm trying to modify the file by removing the last 3 lines:
12:39:20 SQL > host echo $(cat test1.sql | head -$(echo $(( $(cat test1.sql | wc -l) - 3 )))) > newfile.sql
The output from that is:
12:32:52 SQL > select 123 from dual; 123 ---------- 123
As you can see I have lost the "return carriages" in my file test1.sql.
How can I do these modifications (removing lines at the end and from the beginning of the file) and to keep the new lines?
How can I do the above and to receive output like:
12:32:52 SQL > select 123 from dual;
123
----------
123
Please, advise?
Oracle Version: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0
Sql Plus Release: 1002000400
Shell: bash