Sponsored Content
Top Forums Shell Programming and Scripting Unable to print block of data Post 302884465 by cskumar on Tuesday 21st of January 2014 06:24:53 AM
Old 01-21-2014
Inout,source code and Error

Hi Akshay,

Please use the below input to simulate the issue.

Code:
Input
------------------
2014 Jan 14 15:12:43:460 GMT +0 BW.Folder-Process_Archive Debug [BW-User] RequestMessage Job-329121 [Services/Peoplesoft/AcV_Add/Interface/SourceRequest.process/Activate/LogEntry]: <ActivityOutput><sendSubject>TEST.GT.TTT.PS.Request._Null_.asasasa.1</sendSubject><replySubject>_INBOX.C0A8F848.24CE52D3CE5F15FB9E0.1</replySubject><certifiedSequenceNumber>0</certifiedSequenceNumber><body><ns0:field xmlns:ns0="http://xmlns.tibco.com/2003/5/bw/plugins/tibrv"><ns0:name>^pfmt^</ns0:name><ns0:id>0</ns0:id><ns0:simple xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:int">10</ns0:simple></ns0:field><ns0:field xmlns:ns0="http://xmlns.tibco.com/2003/5/bw/plugins/tibrv"><ns0:name>^ver^</ns0:name><ns0:id>0</ns0:id><ns0:simple xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:int">30</ns0:simple></ns0:field><ns0:field xmlns:ns0="http://xmlns.tibco.com/2003/5/bw/plugins/tibrv"><ns0:name>^type^</ns0:name><ns0:id>0</ns0:id><ns0:simple xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:int">1</ns0:simple></ns0:field><ns0:field xmlns:ns0="http://xmlns.tibco.com/2003/5/bw/plugins/tibrv"><ns0:name>^encoding^</ns0:name><ns0:id>0</ns0:id><ns0:simple xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:int">1</ns0:simple></ns0:field><ns0:field xmlns:ns0="http://xmlns.tibco.com/2003/5/bw/plugins/tibrv"><ns0:name>^tracking^</ns0:name><ns0:id>0</ns0:id><ns0:msg><ns0:field><ns0:name>^id^</ns0:name><ns0:id>0</ns0:id><ns0:simple xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema"
ttttttttttttttttttttttttttttttttttasasaaaaaaaaaaaaaaaaaaaaa
asaaaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbdsdsdsdsdsdssssssssssssssssssssssssssssssssd
2014 Jan 14 15:12:43:460 GMT +0 BW.Folder-Process_Archive Debug [BW-User] RequestMessage Job-329122 [Services/Peoplesoft/AcV_Add/Interface/SourceRequest.process/Activate/LogEntry]: <ActivityOutput><sendSubject>TEST.GT.TTT.PS.Request._Null_.asasasa.1</sendSubject><replySubject>_INBOX.C0A8F848.24CE52D3CE5F15FB9E0.1</replySubject><certifiedSequenceNumber>0</certifiedSequenceNumber><body><ns0:field xmlns:ns0="http://xmlns.tibco.com/2003/5/bw/plugins/tibrv"><ns0:name>^pfmt^</ns0:name><ns0:id>0</ns0:id><ns0:simple xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:int">10</ns0:simple></ns0:field><ns0:field xmlns:ns0="http://xmlns.tibco.com/2003/5/bw/plugins/tibrv"><ns0:name>^ver^</ns0:name><ns0:id>0</ns0:id><ns0:simple xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:int">30</ns0:simple></ns0:field><ns0:field xmlns:ns0="http://xmlns.tibco.com/2003/5/bw/plugins/tibrv"><ns0:name>^type^</ns0:name><ns0:id>0</ns0:id><ns0:simple xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:int">1</ns0:simple></ns0:field><ns0:field xmlns:ns0="http://xmlns.tibco.com/2003/5/bw/plugins/tibrv"><ns0:name>^encoding^</ns0:name><ns0:id>0</ns0:id><ns0:simple xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:int">1</ns0:simple></ns0:field><ns0:field xmlns:ns0="http://xmlns.tibco.com/2003/5/bw/plugins/tibrv"><ns0:name>^tracking^</ns0:name><ns0:id>0</ns0:id><ns0:msg><ns0:field><ns0:name>^id^</ns0:name><ns0:id>0</ns0:id><ns0:simple xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema"
asasssssssssssssssssssssasasasa
asaaaaaaaaaaaaaaaaaaa

Code:
#!/bin/bash

BASEPATH="/opt/tibco/logs/bw/EAI_Automation"

FILE="Input.log"
echo "File name::${FILE}" 

STARTPT_ENDPT_VAL="5|EOF"

echo "-------STARTPT_ENDPT_VAL--------${STARTPT_ENDPT_VAL}---"

########################################################
#Printing The Final set using different awk methods
########################################################

for(( i=0; i<${#STARTPT_ENDPT_VAL[@]}; i++ ))
do
      STARTPT=`echo ${STARTPT_ENDPT_VAL[$i]}|cut -d"|" -f1`
   ENDPT=`echo ${STARTPT_ENDPT_VAL[$i]}|cut -d"|" -f2`
   if [ ${STARTPT} != "" ] && [ ${ENDPT} == "EOF" ]
   then
     echo "IN SUCCESS CONDITION--"$STARTPT
     nawk -v STPT=$STARTPT 'NR >= STPT { print $0} ' ${BASEPATH}/$FILE 
   else
     echo "IN FAILED CONDITION--"$STARTPT"|"$ENDPT
     nawk 'NR=='${STARTPT}',NR=='${ENDPT}' { print "$0} ' ${BASEPATH}/${FILE}
   fi
done

echo "###############################Print Ends###############################################"
done

Code:
Error log
------------------------
bsss001z$ sh test_script.sh
File name::Input.log
***********MAXIMUM JOBID**********329122
-------STARTPT_ENDPT_VAL--------5|EOF---
test_script.sh: syntax error at line 16: `(' unexpected

Code:
Expected Output--If we run the commands separately
---------------------------------------------------------------------------
IN SUCCESS CONDITION--5
2014 Jan 14 15:12:43:460 GMT +0 BW.Folder-Process_Archive Debug [BW-User] RequestMessage Job-329122 [Services/Peoplesoft/AcV_Add/Interface/SourceRequest.process/Activate/LogEntry]: <ActivityOutput><sendSubject>TEST.GT.TTT.PS.Request._Null_.asasasa.1</sendSubject><replySubject>_INBOX.C0A8F848.24CE52D3CE5F15FB9E0.1</replySubject><certifiedSequenceNumber>0</certifiedSequenceNumber><body><ns0:field xmlns:ns0="http://xmlns.tibco.com/2003/5/bw/plugins/tibrv"><ns0:name>^pfmt^</ns0:name><ns0:id>0</ns0:id><ns0:simple xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:int">10</ns0:simple></ns0:field><ns0:field xmlns:ns0="http://xmlns.tibco.com/2003/5/bw/plugins/tibrv"><ns0:name>^ver^</ns0:name><ns0:id>0</ns0:id><ns0:simple xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:int">30</ns0:simple></ns0:field><ns0:field xmlns:ns0="http://xmlns.tibco.com/2003/5/bw/plugins/tibrv"><ns0:name>^type^</ns0:name><ns0:id>0</ns0:id><ns0:simple xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:int">1</ns0:simple></ns0:field><ns0:field xmlns:ns0="http://xmlns.tibco.com/2003/5/bw/plugins/tibrv"><ns0:name>^encoding^</ns0:name><ns0:id>0</ns0:id><ns0:simple xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:int">1</ns0:simple></ns0:field><ns0:field xmlns:ns0="http://xmlns.tibco.com/2003/5/bw/plugins/tibrv"><ns0:name>^tracking^</ns0:name><ns0:id>0</ns0:id><ns0:msg><ns0:field><ns0:name>^id^</ns0:name><ns0:id>0</ns0:id><ns0:simple xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema"
asasssssssssssssssssssssasasasa
asaaaaaaaaaaaaaaaaaaa

---------- Post updated 01-21-14 at 06:24 AM ---------- Previous update was 01-20-14 at 12:47 PM ----------

Hi, Can anyone help me for the above issue since I got struck at the last step and need your assistance please.

Regards,
Kumar.
 

10 More Discussions You Might Find Interesting

1. SCO

Non-Root Users Unable to Print

UnixWare 7, Release 7.1.3 We have a customer that has frequent issues with Non-Root users being unable to print. They are able to print w/o issues, but all of the sudden it stops working. The only workaround we have at this point is to reboot the server. It is happening weekly according to... (1 Reply)
Discussion started by: cfshd
1 Replies

2. AIX

Unable to print Cyrillic fonts

Hi All I confifured HP 4250 printer on AIX server..I am unable to print cyrillic fonts prints. Please assist.. (0 Replies)
Discussion started by: kandatihari
0 Replies

3. Shell Programming and Scripting

Unable to set a data to array

Hi All, Iam trying to set the value to the array... Still its not happening Following is the code: #!/usr/bin/ksh filenames="x"; filenames="y"; echo $filenames; echo $filenames; O/P: x x Iam expecting (2 Replies)
Discussion started by: kiranlalka
2 Replies

4. Solaris

NIS slave unable to copy the data bases

Hi, I'm learning for my Solaris 10 sys-admin part 2. I'm now trying to get nis working because for the exercise. I run in to a problem. Setup: Three Systems solaris101 (client) Nothing wrong here havent made any config changes yet. solaris102 (master server) Interfaces ... (1 Reply)
Discussion started by: jld
1 Replies

5. Programming

Unable to publish data

Hi All, In my application, we are using Publish/subscribe model implemented in JAVA and when I implemented it on windows to windows os,it is working fine and able to publish the right data and even when I am trying the same between two different OS i.e between Windows and Solaris sparc or... (1 Reply)
Discussion started by: smartgupta
1 Replies

6. Shell Programming and Scripting

FNR>2 is not working and unable to extract data from a file

Hi, I have a file in windows environment and moved to UNIX through FTP (ASCII format). The file is having with tab delimited file. awk ‘FNR>2' file_cust*.txt >>filnal.txt I have the same file in production; it is working fine with the same procedure. Once we receive the file in windows... (1 Reply)
Discussion started by: onesuri
1 Replies

7. Shell Programming and Scripting

Unable to Print Count

Hi All, I am performing addition of two inetger variables which assigning output to a new variable getting following error. Check1.sh #!/bin/ksh filesrc=/usr/kk/Source1.txt filetgt=/usr/kk/Source2.txt FINAL_COUNTS= `awk '{n++} END {printf "%012d\n",n}' ${filesrc} ${filetgt}`... (3 Replies)
Discussion started by: kmsekhar
3 Replies

8. Shell Programming and Scripting

Unable to print dynamic arguments in for loop

Hi All, I want to pass few dynamic arguments to shell script. The number of arguments differ each time I call the script. I want to print the arguments using the for loop as below. But not working out. for (( i=1; i<=$#; i++ )) do echo $"($i)" done /bin/sh test.sh arg1 arg2 arg3 ... (1 Reply)
Discussion started by: laalesh
1 Replies

9. Shell Programming and Scripting

Unable to retrieve data from shell when connected to Oracle

I am trying to get the data from oracle table to a variable I have tried the below code #/usr/bin/sh echo " I am in correct loop" SPOOL_FILE=/app/scripts/alt.lst sqlplus /nolog <<END_SQL connect bindu/bindu@gis whenever sqlerror exit failure rollback;... (4 Replies)
Discussion started by: Kiransagar
4 Replies

10. Shell Programming and Scripting

Unable to print python array in shell script loop.

I am unable to loop print a python string array in my unix shell script: ~/readarr.sh '{{ myarr }}' more readarr.sh echo "Parameter 1:"$1 MYARRAY= $1 IFS= MYARRAY=`python <<< "print ' '.join($MYARRAY)"` for a in "$MYARRAY"; do echo "Printing Array: $a" done Can you... (10 Replies)
Discussion started by: mohtashims
10 Replies
All times are GMT -4. The time now is 08:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy