Using the following bash script on OS X El Capitan (version 10.11.5) with a 2.8 GHz Intel Core i7 (4 core) processor and a 1TB SSD holding my data and code, the following script:
produces output with the average times (from 10 runs):
Note that grep on OS X does not have a -P option, so I had to modify your script to use basic REs instead of perl REs.
Note that even with commented awk code, my awk script runs in 1/3 the time needed for Aia's perl script (with the grep folded into the perl script).
Could we assume that you didn't time the grep | perl pipeline, but instead just timed the perl script that did not select only lines matching the pattern <factories.*baseQueueName; or is awk really that much slower on your system compared to perl?
It is interesting to note that on your two runs, the timings for the two perl runs were similar and the timing for the two bash, grep, cut runs were similar, but the awk timings were radically different. It is also interesting to note that on the 2nd awk run, the user and sys times were identical to the perl user and sys times, but the elapsed time was grossly longer for awk. Were you running your timing tests on an otherwise idle system?
What timing results do you get running this stripped down awk code a few times:
Don,
With awk I am noticing wild swings within few minutes gap. At the same time perl solution performance is pretty consistent with little variation.
I am dropping my original solution from contest. So I ran below three solutions,, multiple times also after few minutes gap.. Here are the ruff averages I am seeing..
It can't be IO since awk && perl are printing to console..
One might guess that perl is used frequently on your system and awk is used infrequently. If that is the case, perl will always be in your cache (and will get consistent timings) while after a few minutes of inactivity awk will drop out of your cache and the first run after after it has dropped out of the cache will have to be reloaded from disk (needing more time to be loaded) and subsequent runs (while it is in the cache) run on par with perl.
This User Gave Thanks to Don Cragun For This Post:
Hi, please help on this. I want extract values of xml file structure and print in determined way.
<ProjectName> --> only appears once
<StructList> --> is the top node
<Struct> node --> could be more than 1
NameID, STX, STY, PRX, PRY --> appears only 1 time within each <Struct> node... (10 Replies)
Hi
I have got a XML file which has got content as follows:
<FUNCall81110000 Tag="81110000" CallDate="25/08/11" CallTime="00:03:22" TotalUsageValue="30" MeasurementUnit="1"/>
I want to remove TotalUsageValue="30" only
and TotalUsageValue="XXXXX"
here XXX can be any value. (1 Reply)
hi, i am new to unix and i have a problem.
--------------------------------------------------------------
sebben.xml
<envelope>
<email> sebben@example.com
</email>
</envelope>
script_mail written in the vi editor.
#!/bin/sh
script to change the value in attribute <email>
echo... (3 Replies)
Hi,
I need to capture all the attributes with delete next to it. The source XML file is attached.
The output should contain something like this below:
Attributes = legacyExchangeDN
Action = Delete
Username = Hero Joker
Loginid = joker09
OU =... (4 Replies)
Hi All,
Please help me out in resolving this..
<secondTag enabled='true' processName='test1' pidFile='/tmp/test1.pid' />
From the above tag, I'm trying to retrieve the value of enabled and pidFile attributes by means of processName attribute.
Would be thankful in resolving this..... (5 Replies)
Hi,
I like to set a variable "name" automatically by reading an xml file. My code looks like this:
set name = `awk '/<generationTime>/,/<\/generationTime>/ p' $xml_name`
the "name" is thus set to
<generationTime>2004-12-01T08:23:50.000000</generationTime>
How can I separate this line,... (3 Replies)
I have an xml file.I want to change the value of some tag:
<WASConfig version='1.1'>
<JavaVirtualMachine>
<scope>
<server>
<hostNode>myAsNode</hostNode>
<name>myserver</name>
</server>
</scope>
<Settings>
<Setting>
... (5 Replies)
Greetings,
I am very new to the UNIX shell scripting and would like to learn. However, I am currently stuck on how to process the below sample of code from an XML file using UNIX comands:
<ATTRIBUTE NAME="Memory" VALUE="512MB"/>
<ATTRIBUTE NAME="CPU Speed" VALUE="3.0GHz"/>
<ATTRIBUTE... (5 Replies)
I have a rather large file with XML-style content. Each line contains one full XML entry. For example:
1:<Message><DNIS>1234</DNIS><UCID>3456</UCID><TransferGroup>XYZXYZ</TransferGroup></Message>
2:<Message><DNIS>9999</DNIS><UCID>2584</UCID><TransferGroup>ABCABC</TransferGroup></Message>... (1 Reply)