- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- PERL script needed
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
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
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
08-04-2005 10:59 PM
08-04-2005 10:59 PM
i need to know the unique store key with number of items for it.
for example .
121882|18281684|100|250416|2
121882|18281684|100|250416|30
$3=store key ; $5=items
Output:
unique store key 100 with 32 items
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2005 11:03 PM
08-04-2005 11:03 PM
Re: PERL script needed
my ($key, $items) = (split /\s*\|\s*/)[2,4];
or inside the loop:
while (<>) {
chomp;
my ($key, $items) = (split /\s*\|\s*/)[2,4];
}
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2005 12:09 AM
08-05-2005 12:09 AM
Re: PERL script needed
open (INP,"testcpn1.txt");
while($x=
chomp($x);
my($key,$items)=split(/\s*\|\s*/)[2,4];
@count[$key]+=$items;
}
close (INP);
foreach $i (@count)
{
print $i."|".$count[$i];
}
am getting out put as 0|0
please can you look at this and give me the proper way.
Thanks in Advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2005 12:47 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2005 02:01 AM
08-05-2005 02:01 AM
Re: PERL script needed
Thanks a lot.
please here are some of the other queries
1. i need to find out the count of number of unique stores in it.
2. i have a date field(fourth field ($4)) in my file with format 2005-01-23 00:00:00. from this i want to extract the hourth value.how can i do it with perl.
in awk i have written it succesfully
BEGIN{
FS=OFS="|"
}
{
dat=split($4,aa," ") //
hour=split(aa[2],bb,":")
count[bb[1]]++
}
END{
for(i in count)
{
print "Hour", i,"th number of transactions happened = " count[i];
}
}
please can u write this script in perl.
Thanks in Advance.
i need to convert all of my awk excercise in to perl.
because awk behaves erratically for numbers beyond 4294967296 (2^32)
Please do the need.
Great Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2005 02:08 AM
08-05-2005 02:08 AM
Re: PERL script needed
Good.
> Thanks a lot.
Thank can be expressed in assigning points
> please here are some of the other queries
> 1. i need to find out the count of number of unique stores in it.
print scalar keys %count;
> 2. i have a date field(fourth field ($4)) in my file with format 2005-01-23 00:00:00.
> from this i want to extract the hourth value.how can i do it with perl.
my $hour = ($date_fld =~ m/\s+(\d+)/);
> in awk i have written it succesfully
awk is not my specialty. I consider awk a dead language, only useful for very easy tasks
> i need to convert all of my awk excercise in to perl.
# a2p <script.awk > script.pl
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2005 02:27 AM
08-05-2005 02:27 AM
Re: PERL script needed
my ($hour) = ($date_fld =~ m/\s+(\d+)/);
FWIW, you could also consider using Date::Calc
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2005 06:03 PM
08-05-2005 06:03 PM