06-10-2008
csv content to call out selected function
Hi .. I am new to shell scripting
I need to extract data from a csv file to call out selected function
Sample contents of CSV
PWR_JB, TB, Hk101, CB, Status,A
PWR_JB, TB, HK101, OS, Status,B
PWR_JB, 88V,SG201, OS, Status,B
PWR_JB, TB, SG402, CB, Status,A
PWR_JB, 88V,SG202, CB, Status,A
eg. If column 5,row 1 equal to A , the data from row 1 will be stored
in B1,B2,B3,Elem,Info and call out function TestA().
f column 5,row 2 equal to B , the data from row 1 will be stored
in B1,B2,B3,Elem,Info and call out function TestB()
#!/bin/ksh
# start of function define
TestA(){...........
......................
ta/$1/$2/$3/$4/$5
.......................
}
TestB(){...........
......................
ta/$1/$2/$3/$4/$5
.......................
}
TestC(){...........
......................
ta/$1/$2/$3/$4/$5
.......................
}
# Main
................
TestA $B1 $B2 $B3 $Elem $Info
...................
TestB $B1 $B2 $B3 $Elem $Info
...................
TestC $B1 $B2 $B3 $Elem $Info
any sugguestion?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I want to capture contents of a file between 2 strings into another file
for eg all lines in between the keywords "start log" and "end log" should be copied into another file (1 Reply)
Discussion started by: misenkiser
1 Replies
2. Programming
Hi, Can anyone help me figure out the problem I'm having with a function call?
I have a header file, which sets an enum:
typedef enum {INFO, WARNING, FATAL} Levels;
int log_event (Levels, char *fmt, ...);
..then the function is called this way:
log_event(INFO, "Message text");
... (6 Replies)
Discussion started by: Stevhp
6 Replies
3. Shell Programming and Scripting
I have a function check_ok in my abc.sh. which return me 1 or 0 . I want to call this fuction through other shell script. this shell also send two parameter to calling function.
Can you please tell me how. I am very new in unix.
#!/bin/bash
date_equal()
{
sqlplus -silent... (4 Replies)
Discussion started by: Jamil Qadir
4 Replies
4. Shell Programming and Scripting
hi,
can any one help me to correct this function call.
awk -F "," '{ {first=$1; sec=$2; tro=$3;quat=$4 }
if (tro == "")
{
$3 = search "$file2" "$first" "$file3"
{print $1","$2","$3","$4} }
else
{print $1","$2","$3 $4}}' $file1 > $file
search ()
{ (2 Replies)
Discussion started by: kamel.seg
2 Replies
5. Shell Programming and Scripting
hello,
when i call function inside awk traitement it doesn't work, i don't have error execution but i don't get result and if i call the function outside awk traitement it work well..
there's something special in awk call function??
here is the example :
awk -F "," '{ {first=$1; sec=$2;... (3 Replies)
Discussion started by: kamel.seg
3 Replies
6. Infrastructure Monitoring
Hello,
I have a problem with package and name space.
require "/Mehran/DSGateEngineLib/general.pl";
use strict;
sub System_Status_Main_Service_Status_Intrusion_Prevention
{
my %idpstatus;
my @result;
&General_ReadHash("/var/dsg/idp/settings",\%idpstatus);
#print... (4 Replies)
Discussion started by: Zaxon
4 Replies
7. Shell Programming and Scripting
Hi all,
in my csv file it'll look like this, and of course it may have more columns
US to UK;abc-hq-jcl;multimedia
UK to CN;def-ny-jkl;standard
DE to DM;abc-ab-klm;critical
FD to YM;la-yr-tym;standard
HY to MC;la-yr-ytm;multimedia
GT to KJ;def-ny-jrt;critical
I would like to group... (4 Replies)
Discussion started by: tententen
4 Replies
8. Shell Programming and Scripting
Hi foiks
i am unable to find what is wrong in my code
mu functionality is to exit from shell when i give 99 but it is not calling function ext
Could you please correct me.
read option
if ;
then
ext
else
echo "out"
fi
function ext
{
echo "tested 99 and exit... (12 Replies)
Discussion started by: kojo
12 Replies
9. Shell Programming and Scripting
Below is my script that is function properly per my conditions but I am facing one problem here that is when one function fails then Iy should not check other functions but it calls the other function too So anyone can help me how could i achieve this?
iNOUT i AM GIVING TO THE... (1 Reply)
Discussion started by: rohit22hamirpur
1 Replies
10. Shell Programming and Scripting
Hi Team,
I m getting my script commands output like given below
GETA-TILL-INF;
U-UU-YRYT-NOD-6002 2015-05-14 THU 19:44:10
C2221 RETRIEVE TILL INFORMATION : COMPLD
----------------------------------------------------------------------
CONNECT_CARD_ID ... (9 Replies)
Discussion started by: Ganesh Mankar
9 Replies
LEARN ABOUT DEBIAN
heap::elem::ref
Heap::Elem::Ref(3pm) User Contributed Perl Documentation Heap::Elem::Ref(3pm)
NAME
Heap::Elem::Ref - Object Reference Heap Elements
SYNOPSIS
use Heap::Elem::Ref( RefElem );
use Heap::Fibonacci;
my $heap = Heap::Fibonacci->new;
my $elem;
foreach $i ( 1..100 ) {
$obj = myObject->new( $i );
$elem = RefElem( $obj );
$heap->add( $elem );
}
while( defined( $elem = $heap->extract_top ) ) {
# assume that myObject object have a method I<printable>
print "Smallest is ", $elem->val->printable, "
";
}
DESCRIPTION
Heap::Elem::Ref is used to wrap object reference values into an element that can be managed on a heap. Each referenced object must have a
method cmp which can compare itself with any of the other objects that have references on the same heap. These comparisons must be consis-
tant with normal arithmetic. The top of the heap will have the smallest (according to cmp) element still remaining. (See
Heap::Elem::RefRev if you want the heap to always return the largest element.)
The details of the Elem interface are described in Heap::Elem.
The details of using a Heap interface are described in Heap.
AUTHOR
John Macdonald, john@perlwolf.com
COPYRIGHT
Copyright 1998-2007, O'Reilly & Associates.
This code is distributed under the same copyright terms as perl itself.
SEE ALSO
Heap(3), Heap::Elem(3), Heap::Elem::RefRev(3).
perl v5.8.8 2007-10-23 Heap::Elem::Ref(3pm)