How to limit output


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to limit output
# 1  
Old 03-02-2009
How to limit output

hello, i'm trying to figure out a way to limit the output from an SQL query that is counting the number of occurances of a value in a field and the problem is when i run this query against a huge file with many unique values the output is pretty huge.

Is there a way i can specifically LIMIT the output form the query or query the size of the output file while it's being loaded and do something to LIMIT the output?

I tried the ulmit below but so far in testing it appears to delete the file all together instead of just leaving what already been written to the file.

ulimit -s 512
cat > col.sql <<EOF
set serveroutput on
select 'loan_nbr' , count(*) , loan_nbr from xxx.yyyyy_CREDIT_SCORE group by loan_nbr order by count(*) desc;
exit;
EOF
sqlplus -s xxxxxxx/xxxxxxxxxx@xxxx < col.sql >> xxx.yyyyy_CREDIT_SCORE_LOAN_NBR.out
size=`ls -l xxx.yyyyy_CREDIT_SCORE_loan_nbr.out | awk '{print $5}'`

Just an fyi, i'm trying to do some data analysis on a bunch of files and identify the control or parent values but LIMIT the output when i encounter a amount or unique value that is not a control or meta type data.
# 2  
Old 03-02-2009
Since you're using Oracle, the SQL syntax to do this to add a rownum limit to your WHERE clause.

Code:
SELECT field2, field2 FROM table_name WHERE <whatever> AND rownum < 1000;

# 3  
Old 03-02-2009
Thanks very much ShawMilo i will give that a try, appreicate that!

BobK
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Limit the number of characters in bash output

Hi, I need some help with this: I'm making a script which does a couple of things with image files. The script is supposed to echo the number of each image it is processing like this: Processing image1.jpgThe problem is with images with very long filenames, so I want to know how to limit the... (5 Replies)
Discussion started by: Shadow_Reaper
5 Replies

2. Solaris

Limit: stacksize: Can't remove limit

Hi all, I'm using to Solaris machine. When I run a simple script this messenger come out:"limit: stacksize: Can't remove limit". Any one know the way to resolve this problem without reboot the machine? Thanks in advance. (3 Replies)
Discussion started by: Diabolist9
3 Replies

3. UNIX for Dummies Questions & Answers

Limit the number of characters in a bash output

I have a script that outputs the weather on two lines. If possibly I would like to set a character limit on them Currently it outputs something like but I would like to limit the lines so appends an ellipsis if nescessary: This is the script #! /bin/bash curl -s --connect-timeout... (2 Replies)
Discussion started by: Light_
2 Replies

4. Shell Programming and Scripting

Limit output in awk

Hi All, I want to delimit the output using awk. For eg:: a,b,c,d,e,f abc,def,ghi should change to a|b|c|d|e|f abc|def|ghi Or to put in another way.. OFS will work in the following code if I seperate the values with comma (eg. $1,$2,$3,$4,$5,$6 ). But since the no. of... (3 Replies)
Discussion started by: PRKS
3 Replies

5. Shell Programming and Scripting

How to group the output w/ limit

Hi All, Second time to post on this group :) I'm pulling my hair now 'coz I'm so dumb to produce this requirement. Requirement: I want to run a utility by limiting the no. inside my process (mov##) to be able to use in multi streaming. Here is my script: --Input: "user_list.txt"... (0 Replies)
Discussion started by: alvingo
0 Replies

6. Shell Programming and Scripting

Is there a way to limit DIFF output

Hello is there a way to limit the number of lines output by the DIFF command? I tried -C 200 ect and -c but it continues to print out the whole huge file. Reason needed is i'm trying to do alot of DIFFs on a long list of files and would like to only get back an indicator which files are... (2 Replies)
Discussion started by: bobk544
2 Replies

7. UNIX for Dummies Questions & Answers

Directory limit

I'm setting up a file server for users. Does anyone know how I can limit each users directory to 500MB? -------------- Runing Solaris 8 (3 Replies)
Discussion started by: merlin
3 Replies

8. UNIX for Dummies Questions & Answers

Limit command

I have installed vnc on my computer but do not want every one to be able to incite a vncserver how can I limit users of the vncserver command to only a specifc group? (1 Reply)
Discussion started by: macdonto
1 Replies

9. Shell Programming and Scripting

is there anyscript to limit ip..

Hello All. is there anyscript or way to limit hosts/ips for users? freebsd4.4-stable thanks (11 Replies)
Discussion started by: star
11 Replies

10. UNIX for Advanced & Expert Users

group limit

hi, i have in my /etc/group an unix group full. i need to add new user in this group. users need to have the same gid and the same name... is it possible ? can i create a concatenation with an other group or something else ? thx (1 Reply)
Discussion started by: farzolito
1 Replies
Login or Register to Ask a Question