- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Need a Perl script for checking the boundary value...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2008 03:01 PM
07-06-2008 03:01 PM
if the condition is satisfied then it is "Passed" else "Failed"
Input file:
1.Measure1 value>0
2.Measure2 Value>0 and Value<100
3.Measure3 Value>0,Value(Measure 1+ Measure 2 + Measure 3)< Measure4
Test data:
Measure1 100
Measure2 120
Measure3 50
Measure4 300
Result:
1.Measure1 value>0 " Passed"
2.Measure2 Value>0 and Value<100 "Failed"
3.Measure3 Value>0,Value(Measure 1+ Measure 2 + Measure 3)< Measure4 "Passed"
Thanks in adavance
Kumar
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2008 04:20 PM
07-06-2008 04:20 PM
Re: Need a Perl script for checking the boundary values
The 'input file'..
Is that to be interpreted, or are those just the rules to be coded up once?
If interpretted...
This feels more like 'work' to be done for a fee, rather then friendly advice.
But in case someone is nice enough to try to help, please be ready to provide aditional input.
- What is the quality and quantity of the rules to be ready for?
- How may?
- How complex?
- Which 'formulas' SUM only?
- Which variables? Just those listed?
- What values? Integer, Floating Point? Text? Date & Time?
The "test data":
Just one set, or a lists of them
How delimited? Always all measurement present? Always in the same order (such that the script and look at say 'Measure4' and know all data has been seen?
The flip/flop between Measure3 and Measure4
is very nasty... Is Measure3 allowed to be zero or negative? According to the current rules it can be. That "comma" after Value>0 for Measure3, is that an AND or OR?
You may be able to make an awk or perl script clear and clean enough to make the specification be the program?
The followin awk script may, or might not do what you request.
/Measure1/ { Measure1 = value = $2;
print "value>0",
"Measure1", (value>0)? "\"Passed\"" : "\"Failed\""
}
/Measure2/ { Measure2 = value = $2;
print "value>0 and Value<100",
"Measure2", (value>0 && value<100)? "\"Passed\"" : "\"Failed\""
}
/Measure3/ { Measure3 = value = $2;
}
/Measure4/ { Measure4 = $2; value = Measure3;
print "Value>0,Value(Measure 1+ Measure 2 + Measure 3)< Measure4",
"Measure3", (value>0 && (Measure1 + Measure2 + Measure3) < Measure4)? "\"Passed\"" : "\"Failed\""
}
It works for me:
$ awk -f x.awk x
value>0 Measure1 "Passed"
value>0 and Value<100 Measure2 "Failed"
Value>0,Value(Measure 1+ Measure 2 + Measure 3)< Measure4 Measure3 "Passed"
fwiw,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2008 04:28 PM
07-06-2008 04:28 PM
Re: Need a Perl script for checking the boundary values
I'm of the same mind aa Hein: "This feels more like 'work' to be done for a fee, rather then friendly advice."
So, that said, send $$$ or at least show us *what* you have tried and *where* you are stuck. Aret you are looking for a platform agnostic solution (?) or is it that this is really a piece that you need to add to an existing piece of Perl code; hence the language-specific request?
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2008 04:59 PM
07-06-2008 04:59 PM
Re: Need a Perl script for checking the boundary values
As Hein and JRF mention, it seems you are trying to write a general purpose expression interpreter. I've seen something like this for glance's filters in displaying data.
If not trying to evaluation random user input, it might be easy to just write your 4 programs.
Unfortunately neither awk (or perl?) have an eval operator to interpret expressions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2008 07:17 PM