SQL sorrting issue, and unwanted blank line above heading


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting SQL sorrting issue, and unwanted blank line above heading
# 1  
Old 04-11-2010
Power SQL sorrting issue, and unwanted blank line above heading

Hi, I am running a shell script on Compaq Tru64 UNIX V5.1A. I have attached the shill script with the sql script it is calling to extract some data(hyp_dta_Extr.sql), and the results. I need the file to be tab delimited. (please note that I have renamed hyp_dta_Extr.sql to hyp_dta_Extr.txt to attach here). I have two issues:
1 - A blank line is being created above the heading. (The first line is a blank line). I would like to know how to prevent the blank line from being created.
2 - I would like the file to be sorted by the first field. But when I get a syntax error when I try something in hyp_dta_Extr like:
.
.
SELECT DISTINCT
('E'||EMPLID) AS "EMP"||chr(9)||
.
.
WHERE PAYGROUP in ('ABC','DEF','GHI')
ORDER BY EMP;

Appreciate any help..
# 2  
Old 04-12-2010
you can format the file before FTP.

something like:
Code:
sqlplus USERNAME1/PASSWORD1 <<EOD
@hyp_dta_Extr.sql
EOD

grep -v '^$' HR_DTA.txt | sort -n -k1.2 > tmp.$$
mv tmp.$$ HR_DTA.txt

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

In a file, replace blank line by the last line not blank above

Dear All, In a CSV file, say that a given column has been extracted. In that column, information is missing (i.e. blank lines appear). I would like to replace the blank lines by the last valid line (not blank) previously read. For example, consider the extract below: 123 234 543 111... (7 Replies)
Discussion started by: bagvian
7 Replies

2. Shell Programming and Scripting

Sql multi line comment /* shell interpretation issue

Greetings Experts, I do have some basic knowledge of Unix. The task I am trying to do through shell script is to generate the view script for all of the tables which is in YYYYMMDD format (I assume I am on Ksh). I have certain tables that ends in YYYYMMDD format (eg: tbl_20150630) For each... (1 Reply)
Discussion started by: chill3chee
1 Replies

3. Shell Programming and Scripting

SQL Column Heading

Hi, I am selecting few columns from a table using select query in UNIX shell script ans sending the results as E-mail. But the column headings are not displayed fully. Instead it displays only a part of the heading. Please help as how to display it fully. Thanks in advance for your help. (7 Replies)
Discussion started by: pvelmuru
7 Replies

4. Shell Programming and Scripting

Issue deleting blank line from a file

I'm trying to delete the blank lines from the file $Sfile. tried the below set of commands. Both are giving the same error (: bad interpreter: No such file or directory) awk 'NF > 0' $Sfile > $Tfile cat $Tfile sed -i '/^$/d' $Sfile cat $Sfile Not sure if there's any other problem with... (17 Replies)
Discussion started by: Pandee
17 Replies

5. Shell Programming and Scripting

How to remove unwanted elements from the command line?

CREATE TYPE "SUPERB"."OE_L2_FOOTERDATA_REC" OID '1232323232' IS OBJECT ( AWLSTrxId NUMBER, AdjPurchaseAmount NUMBER, Network NUMBER, ConfigVersion NUMBER ); / I wanted my output to be as follow: CREATE TYPE OE_L2_FOOTERDATA_REC OID '1232323232'... (7 Replies)
Discussion started by: jediwannabe
7 Replies

6. Shell Programming and Scripting

remove unwanted specific line range

Hello everyone...I have large txt file and I would like to remove unwanted specific line. My data is like this: So I would like to remove from line below No. until line reassambled like this: Thanks... (4 Replies)
Discussion started by: taxi
4 Replies

7. Shell Programming and Scripting

Fill the empty line by adding line before blank line

FIle A "A" 2 aa 34 3 ac 5 cd "B" 3 hu 67 4 fg 5 gy output shud be A"" 2 aa 34 "A" 3 ac 34 "A" 5 cd 34 "B" 3 hu 67 "B" 4 fg 67 "B" 5 gy 67 (6 Replies)
Discussion started by: cdfd123
6 Replies

8. Shell Programming and Scripting

Replace two blank line with a single blank line

Hi Guys, I have a file in which each set of records are separated by two blank line. I want to replace it with a single blank line. Can you guys help me out? Regards, Magesh (9 Replies)
Discussion started by: mac4rfree
9 Replies

9. UNIX for Advanced & Expert Users

How to Remove the unwanted Blank Lines

I have a file with the below data, i would like to remove the end blank lines with no data. I used the below commands but could not able to succeed, could you please shed some light. Commands Used: sed '/^$/d' input.txt > output.txt grep -v '^$' input.txt > output.txt input.txt file... (5 Replies)
Discussion started by: Ariean
5 Replies

10. Shell Programming and Scripting

to replace unwanted new line characters

Hi how to replace un wanted new line characters. my file contains data like. ramu,sony,"raju \n ravi \n ramya" \n ravi,sarah,"sowmya \n sorry s\ sangam" \n i want replace new line characters in between double coats with single space. for example $ cat input_file ramu,sony,"raju... (3 Replies)
Discussion started by: Raghava
3 Replies
Login or Register to Ask a Question