Sponsored Content
Top Forums UNIX for Dummies Questions & Answers update a table using some conditons Post 302695785 by roshitha roy on Monday 3rd of September 2012 09:01:24 PM
Old 09-03-2012
update a table using some conditons

Hi All,
I have a sample table as below:

A B C
A1 B1.ts
A2 B2.ts
A3 B3-ts
i need to have A1-B1 combination( where B column is a name with timestamp which keeps on changing with systemdate) and update C1 column based on B1.Also B2 will be created only after (say) 30 minutes B1 is created.This code should run only once,so what can be done other than using sleep command inbetween those steps? Please help me with the code for table updation.Thanks
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

update a oracle table using shell script

Hi, I would like to know how to update a table in Oracle database, if a command in one shell script either successfully completes or it fails.(like Y if its success or N if its a failure) While the command is running,I am able to view the log file created in the Unix machine.After the command... (2 Replies)
Discussion started by: ann_124
2 Replies

2. Shell Programming and Scripting

To update a column in a table through shell script

Hi All, I need to write a shell script in UNIX that should accept booking number as an argument and update it with value "NULL" if the transaction date is greater than 2 years. Booking number and transaction_date are the two columns of the table table_booking. Something like this, through... (3 Replies)
Discussion started by: shilpa_acc
3 Replies

3. Emergency UNIX and Linux Support

Global update on a file based on a table

Hi, I 'd like to update the below highlighted values in a sample file based on the following table: 8283879A25918000000000005400000000000065629TTF3 8683884F40273000000000003900000000000047399TTF3 8883884FG0063000000000002600000000000031599TTF3... (7 Replies)
Discussion started by: er_ashu
7 Replies

4. UNIX for Dummies Questions & Answers

How to Update DB table from txt file using CRONJOB in Unix Shell Script

Hi Experts, can guide how we can Update a Database Table using a txt file source Using Unix Shell Scripts. What are the Cron Jobs codes can written to Update DB table. txt file contains record like data. US 09/03/2012 User DocType DocID. these above feilds in txt files need to be updated in... (4 Replies)
Discussion started by: mahesh.sap
4 Replies

5. Shell Programming and Scripting

Update the table using values from a csv file

i want to run update query for oracle which is in up.sql taking values from a.csv. I have implemented shell script to do it. extn="perl" ls -1 | while read file do echo "$file,$extn" > a.csv done up.sql contains update file_list set filename=$1 where extn=$2; The code to update is... (2 Replies)
Discussion started by: millan
2 Replies

6. Shell Programming and Scripting

How to update a Oracle table through shell scripting?

My Code is get_week_date() { `sqlplus -s ${DQM_SQL_LOGON}@${DQM_SID} << EOF SET ECHO OFF SET FEEDBACK OFF SET PAGES 0 SET SERVEROUTPUT ON SET VERIFY OFF SET TRIMSPOOL ON (update file_level_qc fq set FQ.DATA_FILE_NAME='Hyvee_Pharmacy_Solutions_201304_v1.txt'... (2 Replies)
Discussion started by: karthick.cho
2 Replies

7. Shell Programming and Scripting

Insert one table and update another with shellscript

I have a problem with my shell script. I want to insert data from file to table1(empty) and then, compare table1 with table2 and update some fields. The first part is correct, but the second part does not work. The only way it works is if after the first part I truncate table1 and run the script... (1 Reply)
Discussion started by: nika_mill
1 Replies

8. UNIX for Beginners Questions & Answers

Sort by record column, Compare with conditons and export the result

Hello, I am new to Unix and would like to seek a help, please. I have 2 files (file_1 and file_2), I need to perform the following actions. 1 ) Sort the both file by the column 26-36 (which is Invoice number) what is sort command with the column sort? 2) Compare the file_1.sorted and... (3 Replies)
Discussion started by: Usagi
3 Replies

9. Shell Programming and Scripting

Update a database table in a for loop

Im trying to update an informix database table for each occurance of a head_barcode in a file called mw within a for loop please see below - cant get the syntax correct. any help please? for a in `cat /tmp/mw` do sql image - << STOP > /dev/null 2>&1 update doc_table set status =... (4 Replies)
Discussion started by: worky
4 Replies
RRDLUA(1)							      rrdtool								 RRDLUA(1)

NAME
RRDLua - Lua binding for RRDTool SYNOPSIS
require 'rrd' rrd.create(...) rrd.dump(...) rrd.fetch(...) rrd.first(...) rrd.graph(...) rrd.graphv(...) rrd.info(...) rrd.last(...) rrd.resize(...) rrd.restore(...) rrd.tune(...) rrd.update(...) rrd.updatev(...) DESCRIPTION
Calling Sequence This module accesses RRDtool functionality directly from within Lua. The arguments to the functions listed in the SYNOPSIS are explained in the regular RRDtool documentation. The command-line call rrdtool update mydemo.rrd --template in:out N:12:13 gets turned into rrd.update ("mydemo.rrd", "--template", "in:out", "N:12:13") Note that --template=in:out is also valid. Using with Lua 5.1 Start your programs with: --------------------------------------------------------------- package.cpath = '/usr/local/rrdtool-1.3.2/lib/lua/5.1/?.so;' .. package.cpath require 'rrd' --------------------------------------------------------------- OBS: If you configured with --enable-lua-site-install, you don't need to set package.cpath like above. Using with Lua 5.0 The Lua binding for RRDtool needs the Lua module compat-5.1 to work with Lua 5.0. Some Linux distros, like Ubuntu gutsy and hardy, have it already integrated in Lua 5.0 -dev packages, so you just have to require it: require 'compat-5.1' For other platforms, the compat-5.1 module that comes with this binding will be installed for you in the same dir where RRDtool was installed, under the subdir .../lib/lua/5.0. In this case, you must tell your Lua programs where to find it by changing the Lua var LUA_PATH: -- compat-5.1.lua is only necessary for Lua 5.0 ---------------- -- try only compat-5.1 installed with RRDtool package local original_LUA_PATH = LUA_PATH LUA_PATH = '/usr/local/rrdtool-1.3.2/lib/lua/5.0/?.lua' require 'compat-5.1' LUA_PATH = original_LUA_PATH original_LUA_PATH = nil --- end of code to require compat-5.1 --------------------------- Now we can require the rrd module in the same way we did for 5.1 above: --------------------------------------------------------------- package.cpath = '/usr/local/rrdtool-1.3.2/lib/lua/5.0/?.so;' .. package.cpath require 'rrd' --------------------------------------------------------------- Error Handling The Lua RRDTool module functions will abort your program with a stack traceback when they can not make sense out of the arguments you fed them. However, you can capture and handle the errors yourself, instead of just letting the program abort, by calling the module functions through Lua protected calls - 'pcall' or 'xpcall'. Ex: program t.lua --- compat-5.1.lua is only necessary for Lua 5.0 ---------------- -- uncomment below if your distro has not compat-5.1 -- original_LUA_PATH = LUA_PATH -- try only compat-5.1.lua installed with RRDtool package -- LUA_PATH = '/usr/local/rrdtool-1.3.2/lib/lua/5.0/?.lua' -- here we use a protected call to require compat-5.1 local r = pcall(require, 'compat-5.1') if not r then print('** could not load compat-5.1.lua') os.exit(1) end -- uncomment below if your distro has not compat-5.1 -- LUA_PATH = original_LUA_PATH -- original_LUA_PATH = nil --- end of code to require compat-5.1 --------------------------- -- If the Lua RRDTool module was installed together with RRDTool, -- in /usr/local/rrdtool-1.3.2/lib/lua/5.0, package.cpath must be -- set accordingly so that 'require' can find the module: package.cpath = '/usr/local/rrdtool-1.3.2/lib/lua/5.0/?.so;' .. package.cpath local rrd = require 'rrd' rrd.update ("mydemo.rrd","N:12:13") If we execute the program above we'll get: $ lua t.lua lua: t.lua:27: opening 'mydemo.rrd': No such file or directory stack traceback: [C]: in function `update' t.lua:27: in main chunk [C]: ? Return Values The functions rrd.first, rrd.last, rrd.graph, rrd.info and rrd.fetch return their findings. rrd.first returns a single INTEGER representing the timestamp of the first data sample in an RRA within an RRD file. Example returning the first timestamp of the third RRA (index 2): local firstdate = rrd.first('example.rrd', '--rraindex', 2) rrd.last returns a single INTEGER representing the last update time. local lastupdate = rrd.last('example.rrd') rrd.graph returns the x-size and y-size of the created image and a table with the results of the PRINT arguments. local xsize, ysize, averages = rrd.graph ... print(string.format("Image size: %dx%d", xsize, ysize) print("Averages: ", table.concat(averages, ', ')) rrd.info returns a table where the keys and the values represent property names and property values of the RRD. local info = rrd.info("test.rrd") for key, value in pairs(info) do print(key, ' = ', value) end rrd.graphv takes the same parameters as rrd.graph but it returns a table only. The table returned contains meta information about the graph, like its size as well as the position of the graph area on the image. When called with and empty filename, the contents of the graph will be returned in the table as well (key 'image'). rrd.updatev also returns a table. The keys of the table are strings formed by the concatenation of timestamp, RRA index and data source name for each consolidated data point (CDP) written to disk as a result of the current update call. The key values are CDP values. rrd.fetch is the most complex of the pack regarding return values. It returns 5 values: the initial timestamp, the step, two parallel arrays containing the data source names and their data points respectively, and the final timestamp. --require compat-5.1 if necessary package.cpath = '/usr/local/rrdtool-1.3.2/lib/lua/5.0/?.so;' .. package.cpath local rrd = require "rrd" local first, last = rrd.first("test.rrd"), rrd.last("test.rrd") local start, step, names, data = rrd.fetch("test.rrd", "--start", first, "--end", last, "AVERAGE") io.write(string.format("Start: %s (%d) ", os.date("%c", start),start)) io.write("Step size: ", step, " seconds ") io.write("DS names: ", table.concat(names, ', '), " ") io.write("Data points: ", #data[1], " ") io.write("Data: ") for i,dp in ipairs(data) do io.write(os.date("%t", start), " (", start, "): ") start = start + step for j,v in ipairs(dp) do io.write(v, " ") end io.write(" ") end AUTHOR
Fidelis Assis <fidelis@pobox.com> 1.4.8 2013-05-23 RRDLUA(1)
All times are GMT -4. The time now is 02:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy