Sponsored Content
Full Discussion: dynamic output
Top Forums Shell Programming and Scripting dynamic output Post 302410525 by durden_tyler on Tuesday 6th of April 2010 08:14:33 AM
Old 04-06-2010
Quote:
Originally Posted by nitinrp1
...
Assume if there are space before xxx_yyy_aaa_01 , can pls provide me the perl script for this.

SEL elapsedtime ,StartTime,QueryText
FROM dbc.qry
WHERE StartTime >= '2010-03-24 20:10:08'
AND username = 'xxx_yyy_aaa_01'
ORDER BY LastRespTime DESC

or

SEL elapsedtime ,StartTime,QueryText
FROM dbc.qry
WHERE StartTime >= '2010-03-24 20:10:08'
AND username in 'xxx_yyy_aaa_01'
ORDER BY LastRespTime DESC
Here are a few cases I could think of -

Code:
$
$
$ # equal-to (=) operator not followed by space
$ cat file1.sql
SEL elapsedtime ,StartTime,QueryText
FROM     dbc.qry
WHERE    StartTime >= '2010-03-24 20:10:08'
        AND      username ='xxx_yyy_aaa_01'
ORDER    BY LastRespTime DESC
$
$ perl -lne '/^(\s*\w+){2}\s*(.*?)[\s(]*.xxx_yyy_aaa_01.*$/ && print $2' file1.sql
=
$
$ # equal-to (=) operator followed by a space
$ cat file2.sql
SEL elapsedtime ,StartTime,QueryText
FROM     dbc.qry
WHERE    StartTime >= '2010-03-24 20:10:08'
        AND      username = 'xxx_yyy_aaa_01'
ORDER    BY LastRespTime DESC
$
$ perl -lne '/^(\s*\w+){2}\s*(.*?)[\s(]*.xxx_yyy_aaa_01.*$/ && print $2' file2.sql
=
$
$ # IN operator followed by bracket "(" not followed by space
$ cat file3.sql
SEL elapsedtime ,StartTime,QueryText
FROM     dbc.qry
WHERE    StartTime >= '2010-03-24 20:10:08'
        AND      username in('xxx_yyy_aaa_01')
ORDER    BY LastRespTime DESC
$
$ perl -lne '/^(\s*\w+){2}\s*(.*?)[\s(]*.xxx_yyy_aaa_01.*$/ && print $2' file3.sql
in
$
$ # IN operator followed by space followed by bracket "("
$ cat file4.sql
SEL elapsedtime ,StartTime,QueryText
FROM     dbc.qry
WHERE    StartTime >= '2010-03-24 20:10:08'
        AND      username in ('xxx_yyy_aaa_01')
ORDER    BY LastRespTime DESC
$
$ perl -lne '/^(\s*\w+){2}\s*(.*?)[\s(]*.xxx_yyy_aaa_01.*$/ && print $2' file4.sql
in
$
$ # IN operator followed by space not followed by bracket "("
$ cat file5.sql
SEL elapsedtime ,StartTime,QueryText
FROM     dbc.qry
WHERE    StartTime >= '2010-03-24 20:10:08'
        AND      username in 'xxx_yyy_aaa_01'
ORDER    BY LastRespTime DESC
$
$ perl -lne '/^(\s*\w+){2}\s*(.*?)[\s(]*.xxx_yyy_aaa_01.*$/ && print $2' file5.sql
in
$
$

HTH,
tyler_durden
 

10 More Discussions You Might Find Interesting

1. OS X (Apple)

Dynamic DNS

I have a need to regularly add all macs in our domain to dns. Ideally it would work like Wintel machines. Transparently and automatically. What are the tools, scripts, roadblocks to doing so? I'm not talking about DynDNS type of service here. This is the internal dns for where I work. (0 Replies)
Discussion started by: [MA]Flying_Meat
0 Replies

2. Linux

how to dynamic DNS

hi i am using fedora core 5 and i already configured the dhcp server and the dns server but i want to configure dynamic dns to update the dns automatiklly thank you in advance (1 Reply)
Discussion started by: bondoq
1 Replies

3. Programming

dynamic linking

Hi, Could any one tell me solution for this. i have a library in my /usr/lib and latest in /myhome/lib/ (thay differ functionality symbols my application uses symbols from latest lib). when compile and link my application , every thing goes fine but when running the application ld... (4 Replies)
Discussion started by: Raom
4 Replies

4. UNIX for Advanced & Expert Users

Sql dynamic table / dynamic inserts

I have a file that reads File (X.txt) Contents of record 1: rdrDESTINATION_ADDRESS (String) "91 971502573813" rdrDESTINATION_IMSI (String) "000000000000000" rdrORIGINATING_ADDRESS (String) "d0 movies" rdrORIGINATING_IMSI (String) "000000000000000" rdrTRAFFIC_EVENT_TIME... (0 Replies)
Discussion started by: magedfawzy
0 Replies

5. Shell Programming and Scripting

Parsing dynamic data from a command output

Hi people, I am writing a korn shell script, and one of the command gives an output something like below: release.label.2010.03.02 objects: /project/path/to/some/file_name.ksh /project/path/another/file_name01.dat I have to retrieve the file paths one by one & use them as... (9 Replies)
Discussion started by: kiwin1000
9 Replies

6. Shell Programming and Scripting

Dynamic output file generation using a input text file with predefined output format

Hi, I have two files , one file with data file with attributes that need to be sent to another file to generate a predefined format. Example: File.txt AP|{SSHA}VEEg42CNCghUnGhCVg== APVG3|{SSHA}XK|"password" AP3|{SSHA}XK|"This is test" .... etc --------- test.sh has... (1 Reply)
Discussion started by: hudson03051nh
1 Replies

7. Red Hat

Dynamic case creation based on output list from a command

I am attempting to create a script that would allow me to list all the instances associated with a DB2 and then prompt the user to choose which one to issue the db2profile command against. I use the db2 command db2ilist to get a list of the instances for a particular server, but the number of... (1 Reply)
Discussion started by: slatoms
1 Replies

8. Shell Programming and Scripting

Dynamic case creation based on output list from a command

I am attempting to create a script that would allow me to list all the instances associated with a DB2 and then prompt the user to choose which one to issue the db2profile command against. I use the db2 command db2ilist to get a list of the instances for a particular server, but the number of... (7 Replies)
Discussion started by: slatoms
7 Replies

9. Shell Programming and Scripting

Assign output to dynamic variable

Hi Folks, I am trying to assign a value from the command to a dynamic variable. But I am not getting the desired output.. I am sure something is wrong so i need experts advise. There will be multiple files like /var/tmp/server_1, /var/tmp/server_2, /var/tmp/server_3, having different server... (6 Replies)
Discussion started by: ganga.dharan
6 Replies

10. UNIX for Dummies Questions & Answers

awk : dynamic output flatfile filename

Hello, I'm using the awk command to insert empty columns on a tab delimited flatfile - which works fine - => But I'm not able to manage dynamicaly the filename of the awk output based on the source flatfile filename I have 3 source flatfile: flatfile_Jan-2016.csv flatfile_Feb-2016.csv... (3 Replies)
Discussion started by: Tipiak
3 Replies
SIEVESHELL(1)						User Contributed Perl Documentation					     SIEVESHELL(1)

NAME
sieveshell - remotely manipulate sieve scripts SYNOPSIS
sieveshell [--user=user] [--authname=authname] [--realm=realm] [--exec=script] server[:port] sieveshell --help DESCRIPTION
sieveshell allows users to manipulate their scripts on a remote server. It works via MANAGESIEVE, a work in progress. The following commands are recognized: list list scripts on server. put <filename> upload script to server. get <name> [<filename>] get script. if no filename display to stdout delete <name> delete script. activate <name> activate script. deactivate deactivate all scripts. OPTIONS
-u user, --user=user The authorization name to request; by default, derived from the authentication credentials. -a authname, --authname=authname The user to use for authentication (defaults to current user). -r realm, --realm=realm The realm to attempt authentication in. -e script, --exec=script Instead of working interactively, run commands from script, and exit when done. REFERENCES
[MANAGESIEVE] Martin, T.; "A Protocol for Remotely Managing Sieve Scripts", draft-ietf-managesieve-03.txt, Mirapoint, Inc.; May 2001, work in progress. AUTHOR
Tim Martin <tmartin@mirapoint.com>, and the rest of the Cyrus team <cyrus-bugs@andrew.cmu.edu>. perl v5.16.3 2014-06-10 SIEVESHELL(1)
All times are GMT -4. The time now is 12:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy