07-19-2007
Shell_Life
I may be a little dense here - is that an answer for my multiple variable example or for my single variable example?
you used my single var "names" and that's what is confusing me.
I was asking how to script the C_CMD $1 $2 $3 $4 example
if your answer does that, please excuse my thickheadedness - I will try it when I can login again.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I have a situation where I have to specify a different value to an awk command, I beleive i have the gist of this done, however I am not able to get this correct. Here is what I have so far
echo $id
065859555
This value occurs in a "pipe" delimited file in postition 8. Hence I would... (1 Reply)
Discussion started by: jerardfjay
1 Replies
2. Programming
I know multiple values can be returned from a function in C like this:
char **read_file ( char * , unsigned long int * );//this is the function prototypeunsigned long int number_of_words = 0;//variable defined in main() and initialized to 0words_from_dictionary = read_file ( "dictionary.dit" ,... (2 Replies)
Discussion started by: shoaibjameel123
2 Replies
3. Shell Programming and Scripting
I have an input file with contents like:
MainFile.dat:
12247689|7896|77698080
16768900|hh78|78959390
12247689|7896|77698080
16768900|hh78|78959390
12247689|7896|77698080
16768900|hh78|78959390
12247689|7896|77698080
16768900|hh78|78959390
12247689|7896|77698080
16768900|hh78|78959390
... (4 Replies)
Discussion started by: rkrish
4 Replies
4. UNIX for Dummies Questions & Answers
Hi,
I'm trying to write a bash script that takes a file and passes each line from the file into an array with elements separated by column.
For example:
Sample file "file1.txt":
1 name1 a first
2 name2 b second
3 name3 c third
and have arrays such as:
line1 = ( "1" "name1" "a"... (3 Replies)
Discussion started by: ShiGua
3 Replies
5. Shell Programming and Scripting
how can I pass multiple values from command line arguments
example
script.sh -arg1 op1 -arg2 op1 op2 op3 (2 Replies)
Discussion started by: nsk
2 Replies
6. Shell Programming and Scripting
sqlplus -s $USER_ID@$SID/$PWD<<EOF>sql_1.txt
set feedback off
set heading off
select 114032 as c_1 from dual ;
EOF
for i in `cat sql_1.txt`
do
sh script_1.sh $i
Currently i am passing one column value to the single unix variable.
How can i pass the values from 2... (2 Replies)
Discussion started by: rafa_fed2
2 Replies
7. Shell Programming and Scripting
I have a file containing multiple values, some of them are pipe separated which are to be read as separate values and some of them are single value all are these need to store in variables.
I need to read this file which is an input to my script
Config.txt
file name, first path, second... (7 Replies)
Discussion started by: ketanraut
7 Replies
8. Shell Programming and Scripting
Hi Guys,
i have a file where data is in the below format::
data1 data2
data3 data4
data4 data6
my script written as::
#!/bin/ksh
cd $1
at now <<END
sh $2
END
Here i want to pass the values stored in the above file one by one till the end of line.
Here if i am doing it as:: (2 Replies)
Discussion started by: Atp3530
2 Replies
9. Shell Programming and Scripting
:wall: Hi,
I have an XML file with 5 tags. I need to pass values to the XML file from a shell script that will replace values in 2 of the tags. I cannot hardcode the tag values in XML and use replace command in script as the values are likely to change.
Please help !!!!!!!!!!! (2 Replies)
Discussion started by: Monalisaa
2 Replies
10. Shell Programming and Scripting
Hi All,
We have a requirement of picking nth position value by using cut command. value would be delimited by any symbols. We have to pass delimited value and postition to get the value in a string.
ex.
echo "A,B,C,D,E" |cut -d "," -f3
echo "A|B|C|D|E"|cut -d "|" -f2
Kindly frame the... (5 Replies)
Discussion started by: KK230689
5 Replies
RRDp(3) User Contributed Perl Documentation RRDp(3)
NAME
RRDp - Attach RRDtool from within a perl script via a set of pipes;
SYNOPSIS
use RRDp
RRDp::start path to RRDtool executable
RRDp::cmd rrdtool commandline
$answer = RRD::read
$status = RRD::end
$RRDp::user, $RRDp::sys, $RRDp::real, $RRDp::error_mode, $RRDp::error
DESCRIPTION
With this module you can safely communicate with the RRDtool.
After every RRDp::cmd you have to issue an RRDp::read command to get RRDtools answer to your command. The answer is returned as a pointer,
in order to speed things up. If the last command did not return any data, RRDp::read will return an undefined variable.
If you import the PERFORMANCE variables into your namespace, you can access RRDtool's internal performance measurements.
use RRDp
Load the RRDp::pipe module.
RRDp::start path to RRDtool executable
start RRDtool. The argument must be the path to the RRDtool executable
RRDp::cmd rrdtool commandline
pass commands on to RRDtool. Check the RRDtool documentation for more info on the RRDtool commands.
Note: Due to design limitations, RRDp::cmd does not support the "graph -" command - use "graphv -" instead.
$answer = RRDp::read
read RRDtool's response to your command. Note that the $answer variable will only contain a pointer to the returned data. The
reason for this is, that RRDtool can potentially return quite excessive amounts of data and we don't want to copy this around in
memory. So when you want to access the contents of $answer you have to use $$answer which dereferences the variable.
$status = RRDp::end
terminates RRDtool and returns RRDtool's status ...
$RRDp::user, $RRDp::sys, $RRDp::real
these variables will contain totals of the user time, system time and real time as seen by RRDtool. User time is the time RRDtool
is running, System time is the time spend in system calls and real time is the total time RRDtool has been running.
The difference between user + system and real is the time spent waiting for things like the hard disk and new input from the Perl
script.
$RRDp::error_mode and $RRDp::error
If you set the variable $RRDp::error_mode to the value 'catch' before you run RRDp::read a potential ERROR message will not cause
the program to abort but will be returned in this variable. If no error occurs the variable will be empty.
$RRDp::error_mode = 'catch';
RRDp::cmd qw(info file.rrd);
print $RRDp::error if $RRDp::error;
EXAMPLE
use RRDp;
RRDp::start "/usr/local/bin/rrdtool";
RRDp::cmd qw(create demo.rrd --step 100
DS:in:GAUGE:100:U:U
RRA:AVERAGE:0.5:1:10);
$answer = RRDp::read;
print $$answer;
($usertime,$systemtime,$realtime) = ($RRDp::user,$RRDp::sys,$RRDp::real);
SEE ALSO
For more information on how to use RRDtool, check the manpages.
AUTHOR
Tobias Oetiker <tobi@oetiker.ch>
perl v5.12.1 2010-03-22 RRDp(3)