Output trimming after 80 chars


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Output trimming after 80 chars
# 1  
Old 06-24-2010
Power Output trimming after 80 chars

Hi All,

I have a small issue with my shell script, I call a sql query from it and the output of the query is a Varchar2 data of approx 100 chars. But while printing the data on the console, only 80 chars are printed. The same thing happens even while redirecting the output to a file, only 80 chars get into the output file.
Can someone guide what might be going wrong here?

N.B: The output from the SQL query contains spaces as well which I need to preserve (E.g output could be ABCD12 FG234 5T)

Here is my script:

Code:
#!/bin/bash

ORACLE_HOME=/sbcimp/run/tp/oracle/client/v10.2.0.3-64bit
export ORACLE_HOME

username=myuser
password=mypwd
db=mydb
plankey=$1


repoUrl=`$ORACLE_HOME/bin/sqlplus -s $username/$password\@$db << _EOF_ > ./repoURL.txt 2>&1
set heading off
set feedback off
set serverout on
select substr(BD.XML_DEFINITION_DATA,instr(BD.XML_DEFINITION_DATA,'<repositoryUrl>',1)+15,instr(BD.XML_DEFINITION_DATA,'</repositoryUrl>',1)-instr(BD.XML_DEFINITION_DATA,'<repositoryUrl>',1)-15)
    from build b, build_definition bd
    where B.FULL_KEY='$plankey'
      and BD.BUILD_ID = B.BUILD_ID;

exit
_EOF_
`

echo $repoUrl

cat ./repoURL.txt

The actual output I expect is:
https://ims-svn.swissbank.com/prod/ARISK_CORE/GlobalDatabase/ARISK_CORE/branches/release2.5

what I get is:
https://ims-svn.swissbank.com/prod/ARISK_CORE/GlobalDatabase/ARISK_CORE/branches

Last edited by pludi; 06-24-2010 at 02:31 AM.. Reason: code tags, please...
# 2  
Old 06-24-2010
like this?

Code:
# echo $a
https://ims-svn.swissbank.com/prod/ARISK_CORE/GlobalDatabase/ARISK_CORE/branches/release2.5

Code:
# echo ${a%/*}
https://ims-svn.swissbank.com/prod/ARISK_CORE/GlobalDatabase/ARISK_CORE/branches

# 3  
Old 06-24-2010
Hi,

I did not get what you mean ? should I use the variable repoUrl the way your mentioned ?
# 4  
Old 06-24-2010
Hi
Just below your 'set serverout on', add this line and try:

Code:
SET LINESIZE    100

Guru.
# 5  
Old 06-24-2010
Hi Guru,
it still prints only 80 chars
# 6  
Old 06-24-2010
When you run the query standalone say in toad or sqlplus, does it give the desired result to you?

Guru.
# 7  
Old 06-24-2010
Guru, it worked after I did
SET LONG 100
realised it was a clob type column...
thanks for your help !!!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Shell script to split data with a delimiter having chars and special chars

Hi Team, I have a file a1.txt with data as follows. dfjakjf...asdfkasj</EnableQuotedIDs><SQL><SelectStatement modified='1' type='string'><! The delimiter string: <SelectStatement modified='1' type='string'><! dlm="<SelectStatement modified='1' type='string'><! The above command is... (7 Replies)
Discussion started by: kmanivan82
7 Replies

2. Shell Programming and Scripting

Trimming in between the words

Hi i have a log file P12345_15728710:DEBUG:Begin P12345_15728710:DEBUG:Being P12345_15729310:DEBUG:GetAgen P12345_15726510:DEBUG:end i want to trim this file and i want like this 15728710 15728710 15729310 15726510 i tried sed ..but not working.. sed "s/.*P12345__ \(.*\)... (4 Replies)
Discussion started by: navsan420
4 Replies

3. Shell Programming and Scripting

Trimming a string

Hi I need to trim white spaces from strings in a file. Input file is like this: 1_rrc_CatalogGroups.csv = 607 1_rrc_Sales_TopCatalogGroups.csv = 4 1_rrc_Sales_CatalogEntries_CatalogGroup_Rel.csv = 7 Need to trim space before and after = symbol. This is my script: #!/usr/bin/ksh ... (2 Replies)
Discussion started by: sukhdip
2 Replies

4. Shell Programming and Scripting

FTP stores unwanted chars to output file

I want to only store date of all files. However, the below script also store unwanted FTP related lines to output file. Could someone tell me how to ignore them (see output first 6 lines)? Thanks #Defining variables and assigning values USR='admin' PASSWD='abc'... (3 Replies)
Discussion started by: dipeshvshah
3 Replies

5. Shell Programming and Scripting

trimming sequences

My file looks like this: But I would like to 'trim' all sequences to the same lenght 32 characters, keeping intact all the identifier (>GHXCZCC01AJ8CJ) Would it be possible to use awk to perform this task? (2 Replies)
Discussion started by: Xterra
2 Replies

6. Shell Programming and Scripting

Trimming output

I'm trying to parse an output log and I've managed to reduce the output to the lines I need. But I'm having trouble pulling out only the info I'm interested in. The output is 40+ lines and here is a sample Installing AppFresh 0.8.5.pkg from ./InstallerFiles/CustomPKG/26 (26) Installing... (2 Replies)
Discussion started by: kaltekar
2 Replies

7. Shell Programming and Scripting

find 4 chars on 2nd line, 44 chars over

I know this should be simple, but I've been manning sed awk grep and find and am stupidly stumped :( I'm trying to use sed (or awk, find, etc) to find 4 characters on the second line of a file.txt 44-47 characters in. I can find lots of sed things for lines, but not characters. (4 Replies)
Discussion started by: unclecameron
4 Replies

8. UNIX for Advanced & Expert Users

Trimming the spaces

Hi, How can I remove the unwanted spaces in the line. 123456 789 ABC DEF. - I wanna remove the sapces in this line, I need the output 123456789ABCDEF. Pls help me...... (3 Replies)
Discussion started by: sharif
3 Replies

9. Shell Programming and Scripting

How to convert C source from 8bit chars to 16bit chars?

I was using the following bash command inside the emacs compile command to search C++ source code: grep -inr --include='*.h' --include='*.cpp' '"' * | sed "/include/d" | sed "/_T/d" | sed '/^ *\/\//d' | sed '/extern/d' Emacs will then position me in the correct file and at the correct line... (0 Replies)
Discussion started by: siegfried
0 Replies

10. UNIX for Dummies Questions & Answers

trimming a file...

Hi everyone I have this script that appends a line to a file to log the running status of an application. I need to write another script to run as a scheduled job in cron to trim the first x number of lines of this file. Could someone give me an idea how to do this? Regards (1 Reply)
Discussion started by: alwayslearningunix
1 Replies
Login or Register to Ask a Question