Sponsored Content
Full Discussion: Ignore garbage output file
Top Forums Shell Programming and Scripting Ignore garbage output file Post 302813687 by krupasindhu18 on Tuesday 28th of May 2013 02:19:32 AM
Old 05-28-2013
Ignore garbage output file

Hi All,

below is my shell script
Code:
#!/bin/sh
set -x
echo "test for multiple values"
UIDPSWD=`cat /projects/feeds/twest/uidpswd`
echo "oracle connection test"
full=/projects/feeds/twest/test_file
values=`cut -d'|' -f1 $full|sed -e "s/.*/'&'/" -e 's/$/,/g' -e '$s/,$//'`
sqlplus $UIDPSWD <<EOF >/projects/feeds/twest/result.txt
set serveroutput on
set verify off
set heading off
set feedback off
set ECHO OFF
set page 0
#spool /projects/feeds/twest/ouput_file.txt
declare
cursor c1
is select emplid,ACTION,ACTION_DT,ACTION_REASON
from ps_job
where emplid='0740439';
c2 ps_job%rowtype;
begin
for i in c1 loop
EXIT WHEN c1%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(i.emplid|| chr(9) ||i.action||chr(9)||i.action_dt||chr(9)||i.ACTION_REASON);
end loop;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('test Update query: ' || SQLERRM);
end;
/
#spool off;
exit;
EOF

It working fine
Problem-
when i am seeing oupt 'cat /projects/feeds/twest/result.txt'
it is showing proper result with other garbage things like

Code:
SQL*Plus: Release 8.1.7.0.0 - Production on Tue May 28 02:09:14 2013

(c) Copyright 2000 Oracle Corporation.  All rights reserved.


Connected to:
Oracle8i Enterprise Edition Release 8.1.7.4.0 - 64bit Production
With the Partitioning option
JServer Release 8.1.7.4.0 - 64bit Production

SQL> SQL> SQL> SQL> SQL> SQL> SP2-0158: unknown SET option "page"
SQL> SQL>   2    3    4    5    6    7    8    9   10   11   12   13   14   15   16  0740439    HIR     08-SEP-1997     MKT

that i dont want .
How to ignore this garbage
please some one suggest me.


Thanks,
Krupa

Last edited by Franklin52; 05-28-2013 at 03:51 AM.. Reason: Please use code tags
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Removing Garbage output

I am using following code to read myfile.ddl line by line. But the thing is it is printing lot of garbage which are the names of the files and directories in which myfile.ddl is present. Kindly refine the code so that only myfile.ddl contents are only read LOGFILE="logfile.txt"... (4 Replies)
Discussion started by: skyineyes
4 Replies

2. Shell Programming and Scripting

vi command -output garbage char in HP-UX

Hi all , I am new to HP-UX flavour of unix. i am issuing simple "vi" comand on the command prompt it is showing me some garbage character in command prompt itself ..unreadable format. I tried opening an existing file using the vi editor --and same thing ... (3 Replies)
Discussion started by: jambesh
3 Replies

3. Shell Programming and Scripting

reading from a file and pass as variables and ignore # in the file

file.txt contains ------------------ sat1 1300 #sat2 2400 sat3 sat4 500 sat5 I need to write a shell script that will output like the below #output sat1.ksh 1300 sat3.ksh sat4.ksh 500 sat5.ksh my try ------- (4 Replies)
Discussion started by: konark
4 Replies

4. Shell Programming and Scripting

Remove Garbage Output

Hello Friends, In a script i m using different temporary file and i remove them in the end. During script execution i have some garbage output which is not required. For example: Garbage Output ++ rm temp_out temp_a temp_b temp_c ++ rm Filter1 Filter2 Script : Even i am redirecting rm... (7 Replies)
Discussion started by: Danish Shakil
7 Replies

5. Shell Programming and Scripting

Help fix my garbage - File Split Program in Perl

Hi, I have the following, it doesn't work and I know it's crap code. The objective is to split a file with a givin number of codes such as: 01,02,03,...,99 Then return all records with each seperate identifier in a new file. The files being split have lrecl=500, recfm=F, and I... (4 Replies)
Discussion started by: mkastin
4 Replies

6. UNIX for Dummies Questions & Answers

getting garbage values in "df-k" output in solaris

Hi, I am running a command "df -k" to check the HDD utilization i am getting some garbage values in output of the command. Output coming Filesystem kbytes used avail capacity Mounted on /dev/dsk/c1t0d0s7 113197651... (0 Replies)
Discussion started by: varunksharma87
0 Replies

7. Shell Programming and Scripting

getting garbage in the output file of shell script

Hi Everyone, The problem is that I am getting messages other than the script in the current log file. Ideally the script should contain only the messages that are redirected to the log file. How to remove these unwanted data from the log file. Please help if you have any idea how to remove the... (0 Replies)
Discussion started by: vsachan
0 Replies

8. Shell Programming and Scripting

getting garbage in the output file of shell script

Hi, I wrote one shell script and I am calling 1 sql script inside shell script. When I am running the shell script, I am getting actual data as well as garbage data in the output file. Why the garbage is there in the log file. Please help if anybody having any ides. Script: ------- ... (2 Replies)
Discussion started by: vsachan
2 Replies

9. Red Hat

How to find a garbage entry in a column wise text file in Linux?

Suppose I have a file containing :- 1 Apple $50 2 Orange $30 3 Banana $10 4 Guava $25 5 Pine@apple $12 6 Strawberry $21 7 Grapes $12 In the 5th row, @ character inserted. I want through sort command or by any other way this row should either on top or bottom. By sort command garbage... (1 Reply)
Discussion started by: Dipankar Mitra
1 Replies
OCI_PARSE(3)															      OCI_PARSE(3)

oci_parse - Prepares an Oracle statement for execution

SYNOPSIS
resource oci_parse (resource $connection, string $sql_text) DESCRIPTION
Prepares $sql_text using $connection and returns the statement identifier, which can be used with oci_bind_by_name(3), oci_execute(3) and other functions. Statement identifiers can be freed with oci_free_statement(3) or by setting the variable to NULL. PARAMETERS
o $connection - An Oracle connection identifier, returned by oci_connect(3), oci_pconnect(3), or oci_new_connect(3). o $sql_text - The SQL or PL/SQL statement. SQL statements should not end with a semi-colon (";"). PL/SQL statements should end with a semi- colon (";"). RETURN VALUES
Returns a statement handle on success, or FALSE on error. EXAMPLES
Example #1 oci_parse(3) example for SQL statements <?php $conn = oci_connect('hr', 'welcome', 'localhost/XE'); // Parse the statement. Note there is no final semi-colon in the SQL statement $stid = oci_parse($conn, 'SELECT * FROM employees'); oci_execute($stid); echo "<table border='1'> "; while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) { echo "<tr> "; foreach ($row as $item) { echo " <td>" . ($item !== null ? htmlentities($item, ENT_QUOTES) : "&nbsp;") . "</td> "; } echo "</tr> "; } echo "</table> "; ?> Example #2 oci_parse(3) example for PL/SQL statements <?php /* Before running the PHP program, create a stored procedure in SQL*Plus or SQL Developer: CREATE OR REPLACE PROCEDURE myproc(p1 IN NUMBER, p2 OUT NUMBER) AS BEGIN p2 := p1 * 2; END; */ $conn = oci_connect('hr', 'welcome', 'localhost/XE'); if (!$conn) { $e = oci_error(); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); } $p1 = 8; // When parsing PL/SQL programs, there should be a final semi-colon in the string $stid = oci_parse($conn, 'begin myproc(:p1, :p2); end;'); oci_bind_by_name($stid, ':p1', $p1); oci_bind_by_name($stid, ':p2', $p2, 40); oci_execute($stid); print "$p2 "; // prints 16 oci_free_statement($stid); oci_close($conn); ?> NOTES
Note This function does not validate $sql_text. The only way to find out if $sql_text is a valid SQL or PL/SQL statement is to execute it. SEE ALSO
oci_execute(3), oci_free_statement(3). PHP Documentation Group OCI_PARSE(3)
All times are GMT -4. The time now is 02:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy