# Shell scripting and SQL

**URL:** <https://community.unix.com/t/shell-scripting-and-sql/161168>\
**Category:** Shell Programming and Scripting\
**Created:** [April 22, 2006, 12:52am UTC](https://community.unix.com/t/shell-scripting-and-sql/161168 "2006-04-22T00:52:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sendhilmani123](https://community.unix.com/letter_avatar/sendhilmani123/32/6_449c533f586939b6e5f246632a46421f.png) [@sendhilmani123](https://community.unix.com/u/sendhilmani123)\
**Post date:** [April 22, 2006, 12:52am UTC](https://community.unix.com/t/shell-scripting-and-sql/161168/1 "2006-04-22T00:52:14Z")

</div>

Hi,

I have a file that has contents like this:  
SQL\> select \* from details;

NAME REG  
-------------------- ----------  
Mani 1  
Santosh 2  
Manju 3  
Mukesh 4

SQL\> spool off;

I want to remove the first line'select \* from details' and the last line 'spool off'. I also want to remove the lines 'Name Reg and the line below them' and also introduce a new field seperator between values. How can I do it.

---

<div class="post-metadata">

**Author:** ![gauravgoel](https://community.unix.com/letter_avatar/gauravgoel/32/6_449c533f586939b6e5f246632a46421f.png) [@gauravgoel](https://community.unix.com/u/gauravgoel)\
**Post date:** [April 22, 2006, 1:42am UTC](https://community.unix.com/t/shell-scripting-and-sql/161168/2 "2006-04-22T01:42:46Z")

</div>

to remove Name Reg use the following

> [@](#):
>
> set head off

for the rest the following may work, I am not sure though

> [@](#):
>
> set feedback off

or

> [@](#):
>
> set TERMOUT off

or  
somthing similar to above  
Do post ack what work and what not  
Gaurav

---

<div class="post-metadata">

**Author:** ![sendhilmani123](https://community.unix.com/letter_avatar/sendhilmani123/32/6_449c533f586939b6e5f246632a46421f.png) [@sendhilmani123](https://community.unix.com/u/sendhilmani123)\
**Post date:** [April 22, 2006, 2:37am UTC](https://community.unix.com/t/shell-scripting-and-sql/161168/3 "2006-04-22T02:37:48Z")

</div>

Hi,

That worked. But What I want is to print the same in a file without the SQL\>. But when I do the same thing by spooling to a file, I still get the command I issued i.e 'select \* from details and 'spool off'.

I want to remove those also.

Thanks in advance

---

<div class="post-metadata">

**Author:** ![gauravgoel](https://community.unix.com/letter_avatar/gauravgoel/32/6_449c533f586939b6e5f246632a46421f.png) [@gauravgoel](https://community.unix.com/u/gauravgoel)\
**Post date:** [April 22, 2006, 2:42am UTC](https://community.unix.com/t/shell-scripting-and-sql/161168/4 "2006-04-22T02:42:31Z")

</div>

tell me which one worked.  
have you tried the feedback off option

---

<div class="post-metadata">

**Author:** ![sendhilmani123](https://community.unix.com/letter_avatar/sendhilmani123/32/6_449c533f586939b6e5f246632a46421f.png) [@sendhilmani123](https://community.unix.com/u/sendhilmani123)\
**Post date:** [April 22, 2006, 3:22am UTC](https://community.unix.com/t/shell-scripting-and-sql/161168/5 "2006-04-22T03:22:41Z")

</div>

Hi,

Yes. I trie all the 3 options together. What was happening was , the title of the columns was not displayed namely 'Name Reg'. The line also was not displayed.

But the comand 'select \* from details' was displayed and the command 'spool off' was displayed'

Thanks in advance

---

<div class="post-metadata">

**Author:** ![nir\_s](https://community.unix.com/letter_avatar/nir_s/32/6_449c533f586939b6e5f246632a46421f.png) [@nir\_s](https://community.unix.com/u/nir_s)\
**Post date:** [April 22, 2006, 9:06am UTC](https://community.unix.com/t/shell-scripting-and-sql/161168/6 "2006-04-22T09:06:06Z")

</div>

Hi,

Before "spool" command ,issue the following:  
set termout off  
set pause off  
set pagesize 0  
set feedback off  
set time off  
set heading off  
set echo off

Regards,  
Nir
