Sponsored Content
Full Discussion: Problem with arrays
Top Forums Shell Programming and Scripting Problem with arrays Post 302464543 by blito_loco on Wednesday 20th of October 2010 11:22:04 AM
Old 10-20-2010
Problem with arrays

Hi

I have two arrays:

arr1 = (demo demo2 demo3 demo4 demo5)
arr2 = (demo2 test demo)

I want to check that the values the "arr2" are present in "arr1"

Example

arr1 = (demo demo2 demo3 demo4 demo5)
arr2 = (demo2 test demo)

Output: Error

arr1 = (demo demo2 demo3 demo4 demo5)
arr2 = (demo2 demo5)

Output: OK

Thanks for your help SmilieSmilieSmilieSmilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem with arrays in awk

Hello! I'm trying to make a script that will make a list of the files in a source tree and sort them by size. Problem is I've run into a weird problem. print array will give me numbers like 160, 220, 444 that i don't even know where they come from, and print array will give me the correct numbers... (5 Replies)
Discussion started by: Glauco
5 Replies

2. Programming

C programming + problem with char arrays

Im trying to write some code atm which gets the complete pathname of a folder and strips off references to the parent folders. The end result should be just the name of the folder. Currently Im able to extract the folder name, however Im getting junk added onto the name as well which is making... (7 Replies)
Discussion started by: JamesGoh
7 Replies

3. Web Development

PHP arrays in arrays

PHP question... I have an SQL query that's pulled back user IDs as a set of columns. Rather than IDs, I want to use their names. So I have an array of columns $col with values 1,7,3,12 etc and I've got an array $person with values "Fred", "Bert", "Tom" etc So what I want to do is display the... (3 Replies)
Discussion started by: JerryHone
3 Replies

4. UNIX for Dummies Questions & Answers

Problem assigning variables to arrays

Hi All, I have a problem assigning variables to script.I have a script in which i have a while loop now i have to assign some values obtained to an array which will be used later in the script.Can anyone help how to do that. At present my scrot looks like: co=0 pco=0 co=`cat /tmp/highcpu... (4 Replies)
Discussion started by: usha rao
4 Replies

5. Programming

question about int arrays and file pointer arrays

if i declare both but don't input any variables what values will the int array and file pointer array have on default, and if i want to reset any of the elements of both arrays to default, should i just set it to 0 or NULL or what? (1 Reply)
Discussion started by: omega666
1 Replies

6. Shell Programming and Scripting

How can I use the arrays ?

Hi all, I have a file test1.txt with the below contents abc def ghj xyz I tried printing these values using arrays. Script tried : =========== set -A array1 `cat test1.txt` count=${#array1 } i=0 while do echo "element of array $array1" done (1 Reply)
Discussion started by: dnam9917
1 Replies

7. Shell Programming and Scripting

Problem with arrays and loop

Hello , im sorry for my english . im trying to create a dynamic menu that will display if the interface is ACTIVE OR STOPPED/FAILED for some reason i cant get it to work properly start_interface_func() { i=0 for interface_chk in 11 71 73 72 12 47 48 49 50 20 23 24 25 46 21 22 27 28... (5 Replies)
Discussion started by: visiown
5 Replies

8. Programming

problem in multiplying arrays

Hi, this is my code.It's simple : there are 2 2D arrays and the multiplied to C. #include<stdio.h> #include<sys/shm.h> #include<sys/stat.h> #include<stdlib.h> main() { int *A; //A int *B; //B int *C; //C int i,j,x,k,d; int id; ... (17 Replies)
Discussion started by: giampoul
17 Replies

9. Programming

Arrays in C++

I've noticed something interesting in C++ programming. I've always done tricky stuff with pointers and references to have functions deal with arrays. Doing exercises again out of a C++ book has shown me an easier way, I didn't even know was there. It's weird to me. When dealing with arrays, it... (4 Replies)
Discussion started by: John Tate
4 Replies

10. Shell Programming and Scripting

Using arrays?

I have never used arrays before but I have a script like this: var1=$(for i in $(cat /tmp/jobs.021013);do $LIST -job $i -all | perl -ne 'print /.*(\bInfo.bptm\(pid=\d{3,5}).*/' | tr -d "(Info=regpid" | tr -d ')'; $LIST -job $i -all | cut -f7 -d','| sed -e "s/^\(*\)\(*\)\(*\)\(.*\)/\1... (2 Replies)
Discussion started by: newbie2010
2 Replies
RRDUPDATE(1)							      rrdtool							      RRDUPDATE(1)

NAME
rrdupdate - Store a new set of values into the RRD SYNOPSIS
rrdtool {update | updatev} filename [--template|-t ds-name[:ds-name]...] [--daemon address] [--] N|timestamp:value[:value...] at- timestamp@value[:value...] [timestamp:value[:value...] ...] DESCRIPTION
The update function feeds new data values into an RRD. The data is time aligned (interpolated) according to the properties of the RRD to which the data is written. updatev This alternate version of update takes the same arguments and performs the same function. The v stands for verbose, which describes the output returned. updatev returns a list of any and all consolidated data points (CDPs) written to disk as a result of the invocation of update. The values are indexed by timestamp (time_t), RRA (consolidation function and PDPs per CDP), and data source (name). Note that depending on the arguments of the current and previous call to update, the list may have no entries or a large number of entries. Since updatev requires direct disk access, the --daemon option cannot be used with this command. filename The name of the RRD you want to update. --template|-t ds-name[:ds-name]... By default, the update function expects its data input in the order the data sources are defined in the RRD, excluding any COMPUTE data sources (i.e. if the third data source DST is COMPUTE, the third input value will be mapped to the fourth data source in the RRD and so on). This is not very error resistant, as you might be sending the wrong data into an RRD. The template switch allows you to specify which data sources you are going to update and in which order. If the data sources specified in the template are not available in the RRD file, the update process will abort with an error message. While it appears possible with the template switch to update data sources asynchronously, RRDtool implicitly assigns non-COMPUTE data sources missing from the template the *UNKNOWN* value. Do not specify a value for a COMPUTE DST in the update function. If this is done accidentally (and this can only be done using the template switch), RRDtool will ignore the value specified for the COMPUTE DST. --daemon address If given, RRDTool will try to connect to the caching daemon rrdcached at address and will fail if the connection cannot be established. If the connection is successfully established the values will be sent to the daemon instead of accessing the files directly. For a list of accepted formats, see the -l option in the rrdcached manual. N|timestamp:value[:value...] The data used for updating the RRD was acquired at a certain time. This time can either be defined in seconds since 1970-01-01 or by using the letter 'N', in which case the update time is set to be the current time. Negative time values are subtracted from the current time. An AT_STYLE TIME SPECIFICATION (see the rrdfetch documentation) may also be used by delimiting the end of the time specification with the '@' character instead of a ':'. Getting the timing right to the second is especially important when you are working with data-sources of type COUNTER, DERIVE or ABSOLUTE. When using negative time values, options and data have to be separated by two dashes (--), else the time value would be parsed as an option. See below for an example. When using negative time values, options and data have to be separated by two dashes (--), else the time value would be parsed as an option. See below for an example. The remaining elements of the argument are DS updates. The order of this list is the same as the order the data sources were defined in the RRA. If there is no data for a certain data-source, the letter U (e.g., N:0.1:U:1) can be specified. The format of the value acquired from the data source is dependent on the data source type chosen. Normally it will be numeric, but the data acquisition modules may impose their very own parsing of this parameter as long as the colon (:) remains the data source value separator. ENVIRONMENT VARIABLES
The following environment variables may be used to change the behavior of "rrdtool update": RRDCACHED_ADDRESS If this environment variable is set it will have the same effect as specifying the "--daemon" option on the command line. If both are present, the command line argument takes precedence. EXAMPLES
o "rrdtool update demo1.rrd N:3.44:3.15:U:23" Update the database file demo1.rrd with 3 known and one *UNKNOWN* value. Use the current time as the update time. o "rrdtool update demo2.rrd 887457267:U 887457521:22 887457903:2.7" Update the database file demo2.rrd which expects data from a single data-source, three times. First with an *UNKNOWN* value then with two regular readings. The update interval seems to be around 300 seconds. o "rrdtool update demo3.rrd -- -5:21 N:42" Update the database file demo3.rrd two times, using five seconds in the past and the current time as the update times. o "rrdtool update --cache /var/lib/rrd/demo3.rrd N:42" Update the file "/var/lib/rrd/demo3.rrd" with a single data source, using the current time. If the caching daemon cannot be reached, do not fall back to direct file access. o "rrdtool update --daemon unix:/tmp/rrdd.sock demo4.rrd N:23" Use the UNIX domain socket "/tmp/rrdd.sock" to contact the caching daemon. If the caching daemon is not available, update the file "demo4.rrd" directly. WARNING: Since a relative path is specified, the following disturbing effect may occur: If the daemon is available, the file relative to the working directory of the daemon is used. If the daemon is not available, the file relative to the current working directory of the invoking process is used. This may update two different files depending on whether the daemon could be reached or not. Don't do relative paths, kids! AUTHORS
Tobias Oetiker <tobi@oetiker.ch>, Florian Forster <octo at verplant.org> 1.4.7 2009-06-02 RRDUPDATE(1)
All times are GMT -4. The time now is 09:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy