LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 08-20-2011, 12:19 PM   #1
raghu vamshi
LQ Newbie
 
Registered: Aug 2011
Posts: 1

Rep: Reputation: Disabled
Calling a 4ge (informix) report in ashell script


Hi Everyone,

i wanted to call a 4ge (informix) which is a report (which fetches the data) in a shell script and the data has to be mailed to my mail as csv(comma seperated values)
i wrote the script as below

#!/usr/bin/ksh
##. ./.profile # execute profile (dot space dot/.profile)
/exe_la/d4gl/bin/APRjctms00.4ge ${PARM} ${PARM} | mailx -m -s " REPORT" RReddy2@gmail.com
it resulted me the below output

[0m[H[J [0m(0lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk[0m(B[B
[0m(0x[0m(B[2;79H[0m(0x[0m(B[B
[0m(0x[0m(B[3;79H[0m(0x[0m(B[B
[0m(0x[0m(B[4;79H[0m(0x[0m(B[B
[0m(0x[0m(B[5;79H[0m(0x[0m(B[B
[0m(0x[0m(B[6;79H[0m(0x[0m(B[B
[0m(0x[0m(B[7;79H[0m(0x[0m(B[B
[0m(0x[0m(B[8;79H[0m(0x[0m(B[B
[0m(0x[0m(B[9;79H[0m(0x[0m(B[B
[0m(0x[0m(B[10;79H[0m(0x[0m(B[B
[0m(0x[0m(B[11;79H[0m(0x[0m(B[B
[0m(0x[0m(B[12;79H[0m(0x[0m(B[B
[0m(0x[0m(B[13;79H[0m(0x[0m(B[B
[0m(0x[0m(B[14;79H[0m(0x[0m(B[B
[0m(0x[0m(B[15;79H[0m(0x[0m(B[B
[0m(0x[0m(B[16;79H[0m(0x[0m(B[B
[0m(0x[0m(B[17;79H[0m(0x[0m(B[B
[0m(0x[0m(B[18;79H[0m(0x[0m(B[B
[0m(0x[0m(B[19;79H[0m(0x[0m(B[B
[0m(0x[0m(B[20;79H[0m(0x[0m(B[B
[0m(0x[0m(B[21;79H[0m(0x[0m(B[B
[0m(0x[0m(B[22;79H[0m(!
0x[0m(B[B
[0m(0x[0m(B[23;79H[0m(0x[0m(B[B
[0m(0mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj[0m(B[4;3H[0m(0qqqqqqqqqqqqqqqqq[0m(B[0;1m JOBCODE TIME ANALYSIS REPORT CRITERIA [0m[0m(0qqqqqqqqqqqqqqqq[0m(B[7;3H[0;1m Distribution Center: Warehouse: [0m[8;3H[0;1m [0m[9;3H[0;1m Daily Work Assignment From Date : [0m[11;3H[0;1m Daily Work Assignment To Date : [0m[13;3H[0;1m Report Group : [0m[23;3H[0;1mTran: [0m[23;64H[0;1mMode: [0m[23;9HARJCB[23;16H20/08/2011[23;27H08:28 [0;1mEXE TECHNOLOGIES [0m[23;70HMODIFY[2;3H[0;1;7mPress <Enter> to select report options, <Delete> to abort. [0m[7;40H[0;1m19[0m[7;55H[0;1m44[0m[9;53H[0;1m20/08/2011[0m[11;53H[0;1m2!
0/08/2011[0m[7;40H19[7;55H44[9;53H20/08/2011[11;53H20/08/2011


could someone help me with it. Many thanks in advance.

Thanks & Regards
Raghu vamshi

Last edited by raghu vamshi; 08-20-2011 at 12:20 PM.
 
Old 08-21-2011, 10:08 AM   #2
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
The character sequences you're seeing in the above that look like [0m[7 are escape sequences for display on a terminal screen using ncurses, the CRT screen handling and optimization package. Those sequences are specific to a particular terminal type (probably, on your Linux system, an X terminal). Note that a "terminal type" can also be a printer. The sequences are what give you lines, boxes, highlights and the like.

Take a look at the manual pages for ncurses and termcap for a complete explanation. Also execute the env utility:
Code:
env | grep TERM
TERM=xterm
TERMCAP=vs|xterm|xterm-color|vs100|xterm terminal emulator (X Window System):am:bs:km:co#100:li#56:ct=\E[3k:ue=\E[m:is=\E[m\E[?1l\E>:rs=\E[m\E[?1l\E>:eA=\E)0:as=^N:ae=^O:ac=aaffggjjkkllmmnnooqqssttuuvvwwxx:kI=\E[2~:kD=^?:kP=\E[5~:kN=\E[6~:k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~:k5=\E[15~:k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:k0=\E[21~:F1=\E[23~:F2=\E[24~:kh=\E[H:kH=\EOw:ks=:ke=:te=\E[2J\E[?47l\E8:ti=\E7\E[?47h:ms:pt:xn:xo:it#8:RA=\E[?7l:SA=\E?7h:bl=^G:cr=^M:ta=^I:cm=\E[%i%d;%dH:le=^H:up=\E[A:do=\E[B:nd=\E[C:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:DO=\E[%dB:ho=\E[H:cl=\E[H\E[2J:ce=\E[K:cb=\E[1K:cd=\E[J:sf=\ED:sr=\EM:st=\EH:cs=\E[%i%d;%dr:sc=\E7:rc=\E8:ic=\E[@:IC=\E[%d@:al=\E[L:AL=\E[%dL:dc=\E[P:DC=\E[%dP:dl=\E[M:DL=\E[%dM:so=\E[7m:se=\E[m:us=\E[4m:mb=\E[5m:mh=\E[2m:md=\E[1m:mr=\E[7m:me=\E[m:kb=^?:ku=\E[A:kd=\E[B:kr=\E[C:kl=\E[D:
The above is my system, indicating an X-terminal and showing the escape sequences for performing certain actions (yours may vary!). All those two-character alphabetic sequences, such as ue=\E[m, are the functions that the terminal can perform -- us is the curses code for "start underlining" and "escape-bracket-m" is the code that will do so for and X-terminal.

Something to bear in mind here is that the two-character codes are the same across devices, the escape sequences are what's different between devices (look at the termcap data base and note how many different devices are supported).

If you're looking at the report in Gmail, chances are you're not going to see anything that makes sense (as above?); I'm not sure if Gmail strips out escape characters (all those sequences are preceded by an escape character, which, in the termcap data base is indicated as \E. Usually you're looking at Gmail in a web page, not at all the same thing as an X-terminal.

So, what to do? If you can set Gmail to display as a terminal emulator (such as xterm) you ought to see what you expect; however, it's unlikely that you'll be able to do that on a Windows box, eh? Maybe, maybe not, who knows. I have no idea whatsoever of how you can discover what terminal type might be useful with Gmail (perhaps VT-100? I don't know). If you could discover that, then, before you execute your report program simply
Code:
export TERM=whatever
execute the report
And you'd probably get what you want at the other end with no further fiddling around.

As an option, you might try
Code:
export TERM=dumb
execute the report
That, for historic reasons, may strip out all the sequences for you. Put the export in you shell program that launches the report after the line that executes .profile. Might work.

Hope this helps some.

Last edited by tronayne; 08-21-2011 at 10:13 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Create a gui interface of ashell script begin_learn Linux - Newbie 1 06-11-2009 07:46 PM
Calling perl script and passing variable from php script hosea Programming 5 10-21-2008 08:01 AM
how to pass a variable from a called script back to the calling script steven.c.banks Linux - General 2 05-05-2008 02:00 PM
LXer: Report: Indiana's Calling, Is Anyone Listening? LXer Syndicated Linux News 0 07-28-2007 02:01 PM
LXer: Report: This is Red Hat Calling LXer Syndicated Linux News 0 07-25-2006 12:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 04:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration