How to place a tab delimiter in output file [message #110943] |
Fri, 11 March 2005 05:45 |
Naveen Verma
Messages: 60 Registered: August 2004
|
Member |
|
|
Hi
My script fetches data from the database and writes the ouptut to a flat file.My requirement is that the output should be delimited by tab in between columns.
Could anyone help me to sort out this problem.
Thanks and Regards
Naveen
|
|
|
|
Re: How to place a tab delimiter in output file [message #110966 is a reply to message #110962] |
Fri, 11 March 2005 09:43 |
Naveen Verma
Messages: 60 Registered: August 2004
|
Member |
|
|
oh, I am sorry that I didn't specify the thing that I need to place tab in between the field names which I need to write to the file before the execution of sql and some trailer after the sql also. So I need a unix command to place tab.
Thanks for immediate response.
Tthanks
Naveen
|
|
|
Re: How to place a tab delimiter in output file [message #110970 is a reply to message #110943] |
Fri, 11 March 2005 10:15 |
|
Mahesh Rajendran
Messages: 10708 Registered: March 2002 Location: oracleDocoVille
|
Senior Member Account Moderator |
|
|
Forgive my ignorance.
I dont understand your need.
Just spool the sql, you can get the same tab-bed OS file.
or
use awk to create any format you want.
bash-2.03$ cat sample
SMITH CLERK
ALLEN SALESMAN
WARD SALESMAN
JONES MANAGER
MARTIN SALESMAN
BLAKE MANAGER
CLARK MANAGER
SCOTT ANALYST
KING PRESIDENT
TURNER SALESMAN
ADAMS CLERK
JAMES CLERK
FORD ANALYST
MILLER CLERK
bash-2.03$ awk '{print $1","$2}' sample
SMITH,CLERK
ALLEN,SALESMAN
WARD,SALESMAN
JONES,MANAGER
MARTIN,SALESMAN
BLAKE,MANAGER
CLARK,MANAGER
SCOTT,ANALYST
KING,PRESIDENT
TURNER,SALESMAN
ADAMS,CLERK
JAMES,CLERK
FORD,ANALYST
MILLER,CLERK
Or please post a sample file- format.
|
|
|
|