Passing a variable from shell script to mysql query?
I heard this was possible but from my research I haven't been able to figure it out yet. Seems it should be simple enough. Basically from a high level view I'm trying to accomplish...
or something like that.
This is part of my script:
In the my2.sql file:
Any suggestions? Possible? If so what am I doing wrong?
hi;
i have a file containing lines like:
1|1069108123|96393669788|00963215755711|2|0|941||;serv:Pps6aSyria;first:0;bear
i want to extract the second, third and fourth record of each line and store it in a file ";" seperated
this is what i wrote
while read line
do
... (3 Replies)
hi,
I am using a shell script from where i will be conecting to sqlplus..
i am having a problem in passing a variable to sqlplus query..
i will be assigning the variable in the unix environment..whenever i am trying to pass a variable having the contents greater than 2500 characters, i am... (3 Replies)
Hi Everyone,
Can anyone help me how do i call hash variable in to sql query in perl. Please see the script below
i have defined two Hash %lc and %tab as below
$lc{'REFF'}='V_RES_CLASS';
$lc{'CALE'}='V_CAP_CLASS';
$lc{'XRPD'}='V_XFMR_CLASS';
$tab{'V_RES_CLASS'}='V_MFR_SERS';... (6 Replies)
I have a shell script main.sh which inturn call the python script ofdm.py, I want to pass two variables from shell script to python script for its execution. How do i achieve this ?????
Eg:
main.sh
a=3 b=3;
c= a+b
exec python ofdm.py
ofdm.py
d=c+a
Thanks in Anticipation (4 Replies)
Hello. I am writing a simple script that reads a text file and removes records from a mysql database. The items in the text file are of the format:
firstname.middle.lastXXX, where XXX is a 3 digit number. The table has an email field that will match the firstname.middle.last. So, I thought I... (1 Reply)
Hi,
I'm trying to check if methods specified in a class have been added to the corrosponding interface.
My code below is giving me the following errors:
grep: function: No such file or directory
grep: import($zipfile): No such file or directory
grep: function: No such file or... (1 Reply)
I have a script in which i connect to database to run a query and get the result of the query to a temp file. This works fine , now what i want is there is flat file which contains the value to be used in the query. I want to read this file line by line and then run the query for each value in that... (7 Replies)
What I have:
I have a input.sh (script which basically connect to mysql-db and query's multiple tables to write back the output to output1.out file in a directory)
note: I need to pass an integer (unique_id = anything b/w 1- 1000) next to the script everytime I run the script which generates... (3 Replies)
Hello,
I am running ubuntu16.04.
By means of @Rudic's help, I have below command.
What I need to do is to replace video_id by value of video_id in which WHERE clause is matched:
{print "INSERT INTO video_series_files (id, video_id, file_type, protocol, \
url, languages, quality, accessed... (12 Replies)
Discussion started by: baris35
12 Replies
LEARN ABOUT DEBIAN
pthread_getcpuclockid
PTHREAD_GETCPUCLOCKID(3) Linux Programmer's Manual PTHREAD_GETCPUCLOCKID(3)NAME
pthread_getcpuclockid - retrieve ID of a thread's CPU time clock
SYNOPSIS
#include <pthread.h>
#include <time.h>
int pthread_getcpuclockid(pthread_t thread, clockid_t *clock_id);
Compile and link with -pthread.
DESCRIPTION
The pthread_getcpuclockid() function returns the clock ID for the CPU time clock of the thread thread.
RETURN VALUE
On success, this function returns 0; on error, it returns a nonzero error number.
ERRORS
ENOENT Per-thread CPU time clocks are not supported by the system.
ESRCH No thread with the ID thread could be found.
VERSIONS
This function is available in glibc since version 2.2.
CONFORMING TO
POSIX.1-2001.
NOTES
When thread refers to the calling thread, this function returns an identifier that refers to the same clock manipulated by clock_gettime(2)
and clock_settime(2) when given the clock ID CLOCK_THREAD_CPUTIME_ID.
EXAMPLE
The program below creates a thread and then uses clock_gettime(2) to retrieve the total process CPU time, and the per-thread CPU time con-
sumed by the two threads. The following shell session shows an example run:
$ ./a.out
Main thread sleeping
Subthread starting infinite loop
Main thread consuming some CPU time...
Process total CPU time: 1.368
Main thread CPU time: 0.376
Subthread CPU time: 0.992
Program source
/* Link with "-lrt" */
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <string.h>
#include <errno.h>
#define handle_error(msg)
do { perror(msg); exit(EXIT_FAILURE); } while (0)
#define handle_error_en(en, msg)
do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)
static void *
thread_start(void *arg)
{
printf("Subthread starting infinite loop
");
for (;;)
continue;
}
static void
pclock(char *msg, clockid_t cid)
{
struct timespec ts;
printf("%s", msg);
if (clock_gettime(cid, &ts) == -1)
handle_error("clock_gettime");
printf("%4ld.%03ld
", ts.tv_sec, ts.tv_nsec / 1000000);
}
int
main(int argc, char *argv[])
{
pthread_t thread;
clockid_t cid;
int j, s;
s = pthread_create(&thread, NULL, thread_start, NULL);
if (s != 0)
handle_error_en(s, "pthread_create");
printf("Main thread sleeping
");
sleep(1);
printf("Main thread consuming some CPU time...
");
for (j = 0; j < 2000000; j++)
getppid();
pclock("Process total CPU time: ", CLOCK_PROCESS_CPUTIME_ID);
s = pthread_getcpuclockid(pthread_self(), &cid);
if (s != 0)
handle_error_en(s, "pthread_getcpuclockid");
pclock("Main thread CPU time: ", cid);
/* The preceding 4 lines of code could have been replaced by:
pclock("Main thread CPU time: ", CLOCK_THREAD_CPUTIME_ID); */
s = pthread_getcpuclockid(thread, &cid);
if (s != 0)
handle_error_en(s, "pthread_getcpuclockid");
pclock("Subthread CPU time: 1 ", cid);
exit(EXIT_SUCCESS); /* Terminates both threads */
}
SEE ALSO clock_gettime(2), clock_settime(2), timer_create(2), clock_getcpuclockid(3), pthread_self(3), pthreads(7), time(7)COLOPHON
This page is part of release 3.44 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2009-02-08 PTHREAD_GETCPUCLOCKID(3)