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
cvm-sql(7)						 Miscellaneous Information Manual						cvm-sql(7)

NAME
cvm-sql - CVM SQL Framework QUERY SUBSTITUTION
$VAR and ${VAR} are replaced with the quoted value of the environment variable named VAR. Use the second form when VAR contains anything other than alpha-numeric or underscore (_) characters. Do not include quotes in the query. The variables account and domain contain the account and domain names given by the CVM client. $$ is replaced with a single dollar sign. QUERY RESULTS
The query must produce the following fields exactly in order. All required fields must not be null or empty. 1. Password, encrypted with crypt(3) (required) 2. Actual account name (required) 3. User ID (integer) (required) 4. Group ID (integer) (required) 5. Directory (required) 6. Real name (optional) 7. Login shell (optional) 8. Group name (optional) 9. Domain name (optional) 10. System account name (optional) 11. System account directory (optional) 12. Mailbox path (optional) DEFAULT QUERY
SELECT password, username, userid, groupid, directory, realname, shell, groupname, domain, sys_username, sys_directory FROM accounts WHERE username=$account AND domain=$domain SEE ALSO
cvm-mysql(8), cvm-pgsql(8), cvm-pwfile(8), cvm-qmail(8), cvm-unix(8), cvm-vmailmgr(8), cvm-benchclient(8), cvm-checkpassword(8), cvm-test- client(8) http://untroubled.org/cvm/cvm.html cvm-sql(7)
All times are GMT -4. The time now is 10:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy