Visit Our UNIX and Linux User Community


How to format this?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to format this?
# 1  
Old 07-18-2002
Question How to format this?

Hi, All:

I got a output from run a script as follows:

____________________________________________________
SQL*Plus: Release 8.0.5.0.0 - Production on Thu Jul 18 11:25:1 2002

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


Connected to:
Oracle8 Enterprise Edition Release 8.0.5.1.0 - Production
PL/SQL Release 8.0.5.1.0 - Production

SQL> SQL> SQL>
PRIM_T PRIM_T_OFFSET PRIM_T_SIZE PRIM_T_MARKER
------ ------------- ----------- -------------
AA0318 149363 14821 2337 *

SQL> Disconnected from Oracle8 Enterprise Edition Release 8.0.5.1.0 - Production
PL/SQL Release 8.0.5.1.0 - Production
BLOCK_01022001 *
____________________________________________________

This is only part of the output, a lot same thing I didn't list here. What I really want to do is to have that two line with * formated like below:

BLOCK_01022001: AA0318 149363 14821 2337

Could anyone give me a help?

Thanks in advance!

yun
# 2  
Old 07-19-2002
Since this output is from a script you should ask in the Shell Programming and Scripting Q & A forum.
# 3  
Old 07-19-2002
This is not really a matter of unix, but one ofsql .
you should make your sql script look like the following :
  • set hea off;
  • set echo off;
  • set pagesize 0;
  • spool outputfile;
  • select whatever you need
  • from whatever
  • where whatever;
  • spool off;

This way you'll get an outputfile which contains only the line(s) you need and it's much eassier to work with this data then.

From where does this "BLOCK_01022001" thing come ?
Is it a fixed value ?
Smilie
# 4  
Old 07-19-2002
Oops, sorry for the wrong information.
# 5  
Old 07-19-2002
If you need to combine output results from two absolutly different scrips (if you can't combine it in the one), then I think you have to do something like this:

-----
scra:

sqlplus -s /nolog <<EOF
connect ...
@you_script_1_or_just queries
EOF
-----
scrb:

sqlplus -s /nolog <<EOF
connect ...
@you_script_2_or_just queries
EOF
---

to identify you string for output in both queries use any unique values in select, like "select 'UNIQ1', * ....."

main:

result=`scra | grep UNIQ1``scrb | grep UNIQ2`

echo $result

-------------------

I think, that other way to solve the problem - only combine all results in one sql-script. And I think it really possible, all depends of your tasks.
# 6  
Old 07-19-2002
P.S. To combine all tasks in one query you can use PL/SQL procedure, which will generate table with report, and you just will print report in you script
# 7  
Old 07-19-2002
Bug Thank you!

Plelie and Colf:

Thank you so much! What you recommend methods is great, I'll give a try. "BLOCK_01022001" is a fixed table name.

yun
 

Previous Thread | Next Thread
Test Your Knowledge in Computers #778
Difficulty: Medium
Harmonic analysis is a branch of mathematics concerned with the representation of functions or signals as the superposition of basic waves.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need help to format one txt file to required format

Hello Everyone, I have one source file which is genarated by SAP in different format(Which I've never seen). I need to convert that file to required format and I need to read this target file from Datastage to use this in my Jobs. So I do not have any other options except to use Unix script to... (4 Replies)
Discussion started by: Prathyu
4 Replies

2. Shell Programming and Scripting

Need script for transferring bulk files from one format to text format

"Help Me" Need script for transferring bulk files from one format to text format in a unix server. Please suggest (2 Replies)
Discussion started by: Kranthi Kumar
2 Replies

3. Shell Programming and Scripting

perl module to convert xlsx format to xls format

Hi Folks, I have written a perl script that reads data from excel sheet(.xls) using Spreadsheet::ParseExcel module. But the problem is this module doesn't work for excel sheets with extension .xlsx. I have gone through Spreadsheet::XLSX module with which we can read from .xlsx file directly.... (1 Reply)
Discussion started by: giridhar276
1 Replies

4. Shell Programming and Scripting

Converting windows format file to unix format using script

Hi, I am having couple of files which i used to copy from windows to Linux, so now in case of text files (CTRL^M) appears at end of line. I know i can convert this windows format file to unix format file by running dos2unix. My requirement here is that i want to do it automatically using a... (5 Replies)
Discussion started by: sarbjit
5 Replies

5. Shell Programming and Scripting

Retaining the Unix CSV format in Excel format while exporting

Hi All, I have created a Unix Shell script whch creates a *.csv file and export it to Excel. The problem i am facing is that Users wants one of the AMOUNT field in comma separted values. Example : if the Amount has the value as 3000000 User wants to be in 3,000,000 format. This Amount format... (2 Replies)
Discussion started by: rawat_me01
2 Replies

6. Shell Programming and Scripting

Convert UNIX file format to PC format

Hi All, Is there any way to convert a file which is in UNIX format to a PC format.... Flip command can be used , apart form this command can we have any other way.... like usinf "awk" etc ..... main purpose of not using flip is that my Kshell doesnot support this comamnd.... (2 Replies)
Discussion started by: Samtel
2 Replies

7. UNIX for Dummies Questions & Answers

To convert multi format file to a readable ascii format

Hi I have a file which has ascii , binary, binary decimal coded,decimal & hexadecimal data with lot of special characters (like öƒ.ƒ.„İİ¡Š·œƒ.„İİ¡Š· ) in it. I want to standardize the file into ASCII format & later use that as source . Can any one suggest a way a logic to convert such... (5 Replies)
Discussion started by: gaur.deepti
5 Replies

8. UNIX for Dummies Questions & Answers

Convert UTF8 Format file to ANSI format

:confused: Hi i am trying to convert a file which is in UTF8 format to ANSI format i tried to use the function ICONV but it is throwing error Function i used it as $ iconv -f UTF8 -t ANSI filename Error iam getting is NOT Supported UTF8 to ANSI please some help me out on... (9 Replies)
Discussion started by: rajreddy
9 Replies

9. UNIX for Advanced & Expert Users

Convert UTF8 Format file to ANSI format

:) Hi i am trying to convert a file which is in UTF8 format to ANSI format i tried to use the function ICONV but it is throwing error Function i used it as $ iconv -f UTF8 -t ANSI filename Error iam getting is NOT Supported UTF8 to ANSI please some help me out on this.........Let me... (1 Reply)
Discussion started by: rajreddy
1 Replies

10. Shell Programming and Scripting

convert mmddyy date format to ccyyddd format??

hi, for reading a cobol indexed file i need to convert "mmddyy" date format to "ccyyddd" format. i checked the datecalc and other scripts but couldnt modify them to cater to my need:(... The datecalc gives an output which i believe is the total days till that date, but i want to convert it... (2 Replies)
Discussion started by: Bhups
2 Replies

Featured Tech Videos