06-02-2008
passing variable from bash to perl from bash script
Hi Guys,
Now have some other problem with Perl script.
The solution which is given is working perfectly , if the dates are with in same month.If i give dates like this
export FROM_DATE=04/05/2008
export TO_DATE=02/06/2008
perl -ne 'print if ( $_ >= "'$FROM_DATE'" && $_ <= "'$TO_DATE'" )' monitor.audit >$FINAL_DATA
Then nothing is comming in the log file.
monitor.audit
==================
06/05/2008-10:24: orasdfprd01:DATABASE:gecolfdsafprd :1
06/05/2008-10:24: cisdsfsdmarsp010:DATABASE:mafdsrp :1
06/05/2008-10:24: sdfsdacismarsfp011:DATABASE:dxfdslp :1
06/05/2008-10:24: alpfdscisfdfspdb053:DATABASE:mbdsfsop :1
12/05/2008-10:24: cisfsdfmasdfdsfrsp020:APPLCATION :1
12/05/2008-10:24: cisdsfdsfmarsp021:APPLCATION :1
12/05/2008-10:24: alpcsdfdsfispapp054:DISCOVER :0
12/05/2008-10:24: alpcsdfdsispapp055:DISCOVER :1
12/05/2008-10:39: orapsdafdsafrd01:DISK : 456
12/05/2008-10:39: cismdsafsdaarsp010:DISK : 77
12/05/2008-10:39: cisfsdafdsamarsp011:DISK : 138
20/05/2008-10:39: cismsdafsdaarsp020:DISK: 28
20/05/2008-10:39: cismfsdfsdarsp021:DISK: 28
20/05/2008-10:39: alpcsdfdsispapp054:DISK: 190
20/05/2008-10:39: alpcifasfsdaspapp055:DISK: 190
20/05/2008-10:39: alpcfsdafsdaispdb053:DISK: 309
02/06/2008-10:39: orasdfdsprd01:LOAD: 1.05
02/06/2008-10:39: cisdsfdsmarsp010:LOAD:2.86
02/06/2008-10:39: cissdafdsmarsp011:LOAD:0.43
02/06/2008-10:39: cismasadfsdrsp020:LOAD:0.12
02/06/2008-10:39: cismarsdfdssp021:LOAD:0.08
02/06/2008-10:39: alpcisdsfdsapapp054:LOAD:0.44
================================
Please can any one suggest on this .
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I'm just not sure where to start looking into this. I want to be able to create switches for my script. Back in the day I'd make my scripts interactive...you know:
echo "what report do you want"
echo "A)boxes with errors"
echo "B)boxes with more than 5 errors"
echo "C)Service groups that have... (3 Replies)
Discussion started by: DeCoTwc
3 Replies
2. Shell Programming and Scripting
Hi all,
I am running this script on Mandrakelinux release 10.1, 2.6.8.1-12mdksmp #1 SMP
I have also installed 'expect' separately.
I have created an Rsync script, but before any Rsync command does run, a MySql dump must be done first, and I am battling a bit to pass the MySql password from... (2 Replies)
Discussion started by: codenjanod
2 Replies
3. Shell Programming and Scripting
How do I pass a bash variable to a javascript?
I've tried
#!/bin/bash
echo "Content-type: text/html"
echo ""
echo "<html>"
echo "<head>"
counter=0
echo '<script>
window.parent.document.forms.counter.value = "$counter";
</script>'
I have an iframe script which I am trying to pass a... (3 Replies)
Discussion started by: numele
3 Replies
4. Shell Programming and Scripting
Would really appreciate it if someone could point out my mistake in this line of code, i've been staring blankly at it trying everything i can think of some time now and coming up with nothing.
#!/bin/bash
echo "Enter Username"
read Username
awk -F: -v var=${Username} '/^var:/... (9 Replies)
Discussion started by: Nostyx
9 Replies
5. Shell Programming and Scripting
I'm trying to write a basic bash script that takes input you give (what directory, if any, what name, if any ....) and passes the information to find.
I'm trying to just create a string with all variables and then pass it to find. So far I have this extremely simple:
#!/bin/bash -f
... (2 Replies)
Discussion started by: Starting_Leaf
2 Replies
6. Shell Programming and Scripting
Hi,
I meet an problem that it cannot change Terminal environment variable in a perl or bash script.
This change can only exist and become effective in script lifetime.
But I want to make this change take effect in current opened Terminal.
In our view, the thought seems to be impossible,
As... (9 Replies)
Discussion started by: weichanghe2000
9 Replies
7. Shell Programming and Scripting
OS Solaris 10,
DB oracle 10g
Hello,
We currently have a BASH script that runs and moves image files from a remote server to the local db server. A snippet of the code shows that we are picking up all Images that are 'mtime -1'
some code...
for file in `ssh user@10.200.200.10 'find... (3 Replies)
Discussion started by: JonP
3 Replies
8. Shell Programming and Scripting
Hi,
I wanted to pass an argument to a bash script. So that the argument is used inside the awk command inside the bash script.
I know the noraml way of passing argument to a bash script as below :
sh myScript.sh abc
Inside the bash script i can use like this
myArg1=$1
wc $myArg
But... (8 Replies)
Discussion started by: shree11
8 Replies
9. Shell Programming and Scripting
Hi All,
I need to pass a variable from bash script to perl script and in the perl script i am using those variables in the sql query but its giving
error :
Use of uninitialized value $ENV{"COUNTRYCD"} in concatenation (.) or string at /GIS_ROOT/custom/tables/DBread_vendor.pl line 50.
Can ... (6 Replies)
Discussion started by: NileshJ
6 Replies
10. Web Development
I am totally new to PHP and I am trying to create a script that will as a user for a hostname and then use the "hostname" variable to generate a report using REST API.
I am able to create the html script and php script to GET the "hostname" but I am having trouble passing the hostname variable... (10 Replies)
Discussion started by: kieranfoley
10 Replies
LEARN ABOUT DEBIAN
date::hijri
Hijri(3pm) User Contributed Perl Documentation Hijri(3pm)
NAME
Date::Hijri - Perl extension to convert islamic (hijri) and gregorian dates.
SYNOPSIS
use Date::Hijri;
# convert gregorian to hijri date
my ($hd, $hm, $hy) = g2h($gd, $gm, $gy);
# convert hijri to gregorian date
my ($gd, $gm, $gy) = h2g($hd, $hm, $hy);
DESCRIPTION
This simple module converts gregorian dates to islamic (hijri) and vice versa.
The dates must be given as an array containing the day, month and year, and return the corresponding date as a list with the same elements.
EXAMPLES
#!/usr/bin/perl -w
use Date::Hijri;
print join("-", g2h(22,8,2003)); # prints 23-6-1424
print join("-", h2g(23,6,1424)); # prints 22-8-2003
SEE ALSO
This code is just stolen from KDE's kcalendarsystemhijri.cpp at
http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdelibs/kdecore/kcalendarsystemhijri.cpp
Copyright (c) 2002-2003 Carlos Moro <cfmoro@correo.uniovi.es>
Copyright (c) 2002-2003 Hans Petter Bieker <bieker@kde.org>
kcalendarsystemhijri.cpp is translated from the Lisp code
in ``Calendrical Calculations'' by Nachum Dershowitz and
Edward M. Reingold, Software---Practice & Experience,
vol. 20, no. 9 (September, 1990), pp. 899--928.
This code is in the public domain, but any use of it
should publically acknowledge its source.
AUTHOR
Alex Pleiner, <alex@zeitform.de>
COPYRIGHT AND LICENSE
Copyright (c) 2003 zeitform Internet Dienste. All rights reserved. This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
DISCLAIMER
I haven't really tested if the converted dates are right and hope someone will point out mistakes.
Hijri calculations are very difficult. The islamic calendar is a pure lunar calendar, the new month starts by a physical (i.e. human)
sighting of the crescent moon at a given locale. So it depends on several factors (like weather) that make it unreliable to calculate
islamic calendars in advance. As a result the dates calculated by Date::Hijri can be false by one or more days.
Please see http://www.rabiah.com/convert/introduction.html for further explanation.
I'm not a muslim, but interested in Islamic culture, religion and calendar system. I believe in the Internet as a chance to realize that we
live in a small world with multiple cultures, religions and philosophies. We can learn from others and develop tolerance, respect and
understanding.
Salam Alaikum (peace be with you)
perl v5.10.0 2003-08-26 Hijri(3pm)