Hi,
I am using isql and putting the output in a file in a shell script in Linux.
However in my output i am getting the banner and a SQL prompt(at the start and the end of query output)
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL>query output
SQL>
Certainly. Awk syntax is based on a </condition/>{action} pattern that will process every line of the file.
Here, the condition is:
!/^\+|\|/ all lines that does not (the ! in front of the /condition/) start either with + or | (escaped as these are two regex operators)
The action:
{sub(/^SQL>/, "");print}' first replace the SQL> string by nothing if it is at the start of the line. Then, print the modified record.
Because I asked to print only the lines the are *not* starting with + or |. And the remaining lines that are printed are modified to get rid of the SQL prompt.