Nice examples. I took this and made a command I could put into the clipboard and paste into a telnet window. Because I want to select-cut the result into the clipboard I'm wrapping the output onto as few lines as possible.
The Output using the example file is:
I was thinking about the possibility of making the search pattern string contain a list, as in:
I could make the list of search patterns as many as I needed, certainly more than 2. More like a dozen or so search strings (or patterns as they are here). My attempts have failed, ideas?
Last edited by harleyvrodred; 06-10-2017 at 11:18 AM..
Reason: add output script produces
I don't understand. Are you saying that you want to search for a bunch of patterns and return the last element in the XML file that matched any one of those patterns? So, if we look at the last couple of entries in your sample:
and you decide to search for Cabinet Temp and Electronics PID Control Value, you want the output to be:
Note that the 0 comes from multiplying 1667 times the string "-" and the space at the end is because there is no second value after a space in unit="-" like there was in your earlier example with unit="0.1 C".
If we had a clear definition of what you're trying to do, we might be able to help you get there. But, with your current description, I'm not able to guess at the output you hope to achieve.
In the case you mentioned, I'd prefer to see
I tried adding a few more entries to the example, namely Cabinet Temp - would also have the same fields as Coolant Temp. The real-life file has many Temp related entries that I'm interested in. I could use what is here now and use the xml_token function individually with multiple calls for each one, getting the last entry each. I was wondering if there would be a way to use a search string with multiple entries at the same time so it would return the last entry of each.
I know the subset that I’m interested in.
Another approach might be to take each <parameter> name and return the last instance of each. This help?
I'm data mining. Pulling data from site machines for analysis. There is too much to pull it all. I'm just choosing and picking
Last edited by harleyvrodred; 06-10-2017 at 12:55 AM..
I tried adding a few more entries to the example, namely Cabinet Temp - would also have the same fields as Coolant Temp. The real-life file has many Temp related entries that I'm interested in. I could use what is here now and use the xml_token function individually with multiple calls for each one, getting the last entry each. I was wondering if there would be a way to use a search string with multiple entries at the same time so it would return the last entry of each.
I know the subset that I'm interested in.
Another approach might be to take each <parameter> name and return the last instance of each. This help?
I'm data mining. Pulling data from site machines for analysis
We are very glad you know the subset of entries you're interested in. But my crystal ball isn't showing me what is inside your head. What would help would be for us to know the subset of entries you're interested in. Or, if you want the code to determine which entries it should extract, explain to us how you would determine that an entry is interesting by describing what you see on the first line of that <parameter>...</parameter> XML tag that makes it interesting. (Is it that the last word inside the 1st pair of double-quotes is Temp? Is it that string between the 2nd pair of double-quotes is 0.1 C? If it isn't one of these, what is it?)
After you describe the logic that determines which entries are interesting, please show us the exact output that you want your script to produce given the sample you provided in post #4 in this thread. Or post new data in a new post (with CODE tags) and show us the exact output (also in CODE tags) you're hoping to produce from that input with the list of interesting tag values or the logic that you described to determine which tags are interesting.
In the case you mentioned, I'd prefer to see
I tried adding a few more entries to the example, namely Cabinet Temp - would also have the same fields as Coolant Temp. The real-life file has many Temp related entries that I'm interested in. I could use what is here now and use the xml_token function individually with multiple calls for each one, getting the last entry each. I was wondering if there would be a way to use a search string with multiple entries at the same time so it would return the last entry of each.
I know the subset that I'm interested in.
Another approach might be to take each <parameter> name and return the last instance of each. This help?
I'm data mining. Pulling data from site machines for analysis. There is too much to pull it all. I'm just choosing and picking
Run as perl example.pl harleyvrodred.example Output:
from the CLI on a Mac, if you type networksetup -listallnetworkservices then you get results in a multi-line paragraph that look something like this:
networksetup -listallnetworkservices
An asterisk (*) denotes that a network service is disabled.
Wi-Fi
Display Ethernet
Bluetooth DUN... (7 Replies)
Hi,
I have a string which can be completely unstructred. I am looking to parse out values within that String.
Here is an example
<Random Strings> String1=<some number a> String2=<some number b> String3=<some number c> Satish=<some number d> String4=<some number e>
I only want to parse out... (1 Reply)
Can somebody refer me following multicheck to perform across most of unix platform like AIX, HP-UX, solaris, Linux.
CPU utilization above X%
Check IO above X%
Swap usage check above X%
Memory utilization above X% ... (3 Replies)
I got multple sql files.such as
>>vi abc.sql
select A.SITENAME,
NULL
NULL
A.CREATE_DTM
NULL
A.MODIFY_DTM
NULL
FROM ${STG_RET_ITEM} A INNER JOIN ${STG_INC_COMP} B ON (A.CUSTID=B.CUSTID)
LEFT OUTER JOIN ( select C.SITEID,SITESTATUS,MIN_EFF_DT,CURR_ST_DT,MAX_IN_DT,MAX_ACT_DT
from... (4 Replies)
I need to find the MAC address of the ethernet cards on the host machine from the C language. I have found a way to do this on Linux using socket(), ioctl() and the ifreq structure. But this does not seem to work on AIX, HP/UX and probably the others I need (Solaris, SCO, Alpha etc).
Is there a... (7 Replies)
Hi all
I've been working on a bash script parsing through debug/trace files and extracting all lines that relate to some search string. So far, it works pretty well. However, I am challenged by one requirement that is still open.
What I want to do:
1) parse through a file and identify all... (3 Replies)
Hey guys,
I have this file generated by me... i want to create some HTML output from it.
The problem is that i am really confused about how do I go about reading the file.
The file is in the following format:
TID1 Name1 ATime=xx AResult=yyy AExpected=yyy BTime=xx BResult=yyy... (8 Replies)
Does anyone know of any tools that manage the rollout of patches across multiple types of Unix platform ( eg Solaris, Aix etc ).
I am looking for something that does a similiar job to SMS or WSUS in the Windows world (3 Replies)