- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: perl, sed, awk.. date format translation.
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
10-14-2005 12:28 AM
10-14-2005 12:28 AM
Re: perl, sed, awk.. date format translation.
I tried some performance testings with the data you have given in attachment.
ENV : HP-UX 11.11 (Dual @ 800Mhz) Shell :/sbin/sh Perl : v5.8.0
"time" command used to measure exec time.
Perl
====
real 2.9
user 1.6
sys 1.3
Cut
===
real 4.7
user 1.5
sys 3.4
Sed
===
real 0.9
user 0.3
sys 0.6
AWK
===
real 1.0
user 0.4
sys 0.7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2005 12:39 AM
10-14-2005 12:39 AM
Re: perl, sed, awk.. date format translation.
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2005 12:44 AM
10-14-2005 12:44 AM
Re: perl, sed, awk.. date format translation.
Thank you for the kind words! Just a sabbatical.
Warmest Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2005 01:18 AM
10-14-2005 01:18 AM
Re: perl, sed, awk.. date format translation.
model...
9000/800/L1000-36
uname -a...
HP-UX terminal B.11.00 U 9000/800 551706517 unlimited-user license
processors...
Class I H/W Path Driver S/W State H/W Type Description
===================================================================
processor 0 160 processor CLAIMED PROCESSOR Processor
Lest do some tests...
Perl1....
real 0.14
user 0.01
sys 0.01
Perl2....
real 0.19
user 0.00
sys 0.00
Sed...
real 0.02
user 0.01
sys 0.01
Cut...
real 13.24
user 2.85
sys 7.53
Awk...
real 0.04
user 0.03
sys 0.01
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2005 01:58 AM
10-14-2005 01:58 AM
Re: perl, sed, awk.. date format translation.
OK the perl scripts are good, they leave the header intact..
The awk, sed and cut scripts, unfortunately mangle the headder... I can get round this but the tests dont bother...
The scripts used is attached.
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2005 02:15 AM
10-14-2005 02:15 AM
Re: perl, sed, awk.. date format translation.
How does my L1000 beat you rp3440 (i suspect)..
With the exception of cut, my system beats yopu .... yet is is far slower????
10 points for the best explaination...
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2005 02:30 AM
10-14-2005 02:30 AM
Re: perl, sed, awk.. date format translation.
If you are benchmarking you (ideally) need to run your timings in isolation without other processes competing for shared resources.
You need, too, to run multiple passes against the data to smooth out small sample anomolies.
For instance, measuring a process that has to read a file will probably yield a longer time the *first* time when there are no cached buffers available.
I'm not so concerned that a particular piece of code runs faster or slower on your machine versus mine as I am that I can improve speed by tweaking the code in the first place. I'm "old-school": I still (when applicable) give consideration to *which* resource I want to use most --- I/O, memory or processor. Maintainability and readability of code, though, are usually more important than squeezing the last bit of performance out.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2005 09:12 PM
10-14-2005 09:12 PM
Re: perl, sed, awk.. date format translation.
Anyway for those of you with nicer H/W etc I've suppled the scripts and data... have fun..
Many thanks for all the replies I've seen lots of new ways of cracking the same nut.. and I hope if someone else is looking at the thread they get some ideas. I'm rearly dissapointed at the variety of ideas that get thrown up in the HP forum..
sed and cut are really quite forceful.. but just goes to show it can be done within a program (as opposed to code translator). awk & perl very good, and relatively concise... I'm going to use perl with JRF's symbol mofification for code simplicity. (The difference between 0.1 and 0.01s for the files I'm translating is irrelavent)
Angain many thanks for the replies and input... I'll leave this thread open for a few more days (ya never know)
Regards
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2005 04:52 PM
10-15-2005 04:52 PM
Re: perl, sed, awk.. date format translation.
All assume:
$old = "yyyymmddHHMM|.. other stuff here ...";
----------
$old="yyyymmddHHMM|.. other stuff here ...";
foreach (unpack("a4a2a2a2a2a*",$old)) {
$new .= $_ . (qw(/ / | :))[$i++];
}
print "$new\n";
---------- replacing foreach with a join ----
$new = join ((qw(/ / | :))[$i++], unpack("a4a2a2a2a2a*",$old));
print "$new\n";
---------- replacing array lookup by substr ----
$new = join substr("//|:",$i++,1), unpack("a4a2a2a2a2a*",$old);
print "$new\n";
fwiw,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2005 04:13 PM
10-16-2005 04:13 PM
Re: perl, sed, awk.. date format translation.
1) My rp3440 is used as a test machine and many applications are running and taking quite bit memory and CPUs..
2) To measure nearly exact amout of time, we need to use products like NetIQ where you can set customised counters and collect data..
3) Here is another data from rx2600 (IA64)11.23
AWK
===
real 1.08
user 0.28
sys 0.67
SED
===
real 0.89
user 0.20
sys 0.57
cut
===
real 4.73
user 1.00
sys 3.03
Perl
====
real 0.02
user 0.01
sys 0.01
You can see perl beats everything ..
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2005 06:30 PM
10-16-2005 06:30 PM
Re: perl, sed, awk.. date format translation.
If resource is not a matter then use advanced concepts like perl / awk / sed.
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2005 09:18 PM
10-16-2005 09:18 PM
Re: perl, sed, awk.. date format translation.
Muthukumar.. you may well be right about the resource utilisation... but it is analogous to going to work ...you can cycle to work (cut) or drive (perl). If work is only a short distance away, cycling is great and sufficient... if it is a long way away you have little choice, no matter what the efficiency savings are.... untill the overload traffic becomes so slow that it then warrents going back to the bike!!! the system I use is not heavily used by many people, so perl is great as it is the fastest.
Regards
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2005 11:55 PM
10-16-2005 11:55 PM
Re: perl, sed, awk.. date format translation.
Are you still going to keep this thread open ? ;-)
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2005 12:05 AM
10-17-2005 12:05 AM
Re: perl, sed, awk.. date format translation.
Tim
- « Previous
-
- 1
- 2
- Next »