Advertisement

03.23.2008 at 11:25AM PDT, ID: 23262860
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

changing the format of the output in Perl

I have file

DEEP       10
VIN      15
SAH
BAL      1
 

Additionally I have 3 if conditions.




I printing the output to an email. currently prints like this:
DEEP still running
VIN still running
SAH is missing

I want the output something like this

Still runnnng:

DEEP
VIN

Missing:

SAH

Completed:
BAL
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
while(<F>){
@txt_data=split/\t/;
$name = $txt_data[0];
$status = $txt_data[1];
 
 
if ($status gt "9")
print "$name still running";
elsif($staus eq "")
print "$name Missing;
else {
print "$name works fine;
}
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: saibsk
Solution Provided By: nixfreak
Participating Experts: 2
Solution Grade: A
Views: 0
Translate:
Loading Advertisement...
03.23.2008 at 12:01PM PDT, ID: 21190476

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.23.2008 at 12:03PM PDT, ID: 21190482

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.23.2008 at 12:04PM PDT, ID: 21190483

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.24.2008 at 07:13AM PDT, ID: 21193622

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.24.2008 at 12:15PM PDT, ID: 21195993

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.24.2008 at 12:17PM PDT, ID: 21196012

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.24.2008 at 12:29PM PDT, ID: 21196124

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
03.23.2008 at 12:01PM PDT, ID: 21190476
my (@running, @missing, @fine);
while(<F>){
@txt_data=split/\t/;
$name = $txt_data[0];
$status = $txt_data[1];
 
if ($status gt "9") {
  push @running,$name;
} elsif($staus eq "") {
  push @missing,$name;
} else {
  push @fine,$name;
}
print "Still running:\n\n"
while ($_=pop @running) {print $_,"\n";}
print "\nMissing:\n\n"
while ($_=pop @missing) {print $_,"\n";}
print "\nCompleted:\n\n"
while ($_=pop @fine) {print $_,"\n";}
 
03.23.2008 at 12:03PM PDT, ID: 21190482
I don't know if I understood the idea.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
use strict;
use warnings;
 
my %hash;
while(my $line = <F>){
	chomp $line; 
	my ($name, $status) = split /\t/, $line;
 
	if ( not(defined $status) or ( $status eq "" ) ) {
		push(@{$hash{'Missing:'}}, $name);
	} elsif ( $status > 9) {
		push(@{$hash{'Still running:'}}, $name);
	} else {
		push(@{$hash{'Completed:'}}, $name);
	}
}
 
foreach my $key ('Still running:', 'Missing:', 'Completed:') {
	if ($hash{$key}) {
		print join "\n", $key, "", @{$hash{$key}}, "\n"; 
	}
}
Open in New Window
 
03.23.2008 at 12:04PM PDT, ID: 21190483
my (@running, @missing, @fine);
while(<F>){
@txt_data=split/\t/;
$name = $txt_data[0];
$status = $txt_data[1];
 
 if ($status gt "9") {
  push @running,$name;
 } elsif($staus eq "") {
  push @missing,$name;
 } else {
  push @fine,$name;
 }
}
print "Still running:\n\n"
while ($_=pop @running) {print $_,"\n";}
print "\nMissing:\n\n"
while ($_=pop @missing) {print $_,"\n";}
print "\nCompleted:\n\n"
while ($_=pop @fine) {print $_,"\n";}
 
03.24.2008 at 07:13AM PDT, ID: 21193622
I need to add status with the associated name. Could I still use the array to do that or I need to change the data structure to hash? Please advice.
 
03.24.2008 at 12:15PM PDT, ID: 21195993
Please, explain better
 
03.24.2008 at 12:17PM PDT, ID: 21196012
In this step in the above code

push @running,$name;

only name is being pushed onto the array running I want to push the status variable too. such that it stores the data in the running array something like this

$running[0] = [$name, $status];

 
03.24.2008 at 12:29PM PDT, ID: 21196124
you can use a hash instead. like so:

my %running;

$running{$name}=$status;
print "Running:\n\n";
for (keys %running) { printf $_, "\n";}

# or include status in o/p
for (keys %running) { printf $_, "\t", $running{$_}, "\n";}
Accepted Solution
 
 
03.24.2008 at 12:38PM PDT, ID: 21196189
my (%running, %missing, %fine);
while(<F>){
  my ($name, $status) = split /\t/, $line;
  if ($status gt "9") {
    $running{$name}=$status;
  } elsif($staus eq "") {
    $missing{$name}=$status;
  } else {
    $fine{$name}=$status;
  }
}
print "Still running:\n\n"
for (keys %running) { printf $_, "\n";}
# for (keys %running) { printf $_, "\t", $running{$_}, "\n";}
print "\nMissing:\n\n"
for (keys %missing) { printf $_, "\n";}
print "\nCompleted:\n\n"
for (keys %fine) { printf $_, "\n";}


 
 
03.24.2008 at 01:05PM PDT, ID: 21196419
#!/usr/bin/perl

open(F1, "<file4.txt");
while(<F1>){
    @txt_data = split/\t/;
    $t{$txt_data[1]} = [@txt_data[5,7,9]];
}
open(F2, "<data_analized.csv");
while(<F2>){
    @csv_data = split/,/;
    $c{$csv_data[0]} = [@csv_data[1,2,3]] if $t{$csv_data[0]}
}
my @AET=qw(A E T);
for $i( 0,1,2 ){
    for $n( keys %t ){
        next unless $c{$n};
        if( $t{$n}[$i] eq ""){
            $missing{$AET[$i]}=$n;
            }elsif ($t{$n}[$i] =~ /^(\D+)/){
            $info{$AET[$i]}}=$n;
            }elsif (sprintf("%02d:%s",split/:/,$c{$n}[$i]) lt sprintf("%02d:%s",split/:/,$t{$n}[$i])){
            $running{$AET[$i]}=$n;
           
       }
       
    }
}

Now when I am assigning the values to the hashes the missing,runnning I think it is just assigning the latest value to the hash. Should I use something like push? When I use the code below it only prints the last value. Actually till this step it should store something like this
$missing{A}=DEEP
$missing{A}=VIN
$running{E}=SAH

for (keys %missing){
print "$_:\n";
print $missing{$_},"\n";
if(defined $running{$_}){print $running{$_},"\n";}
}
 
 
03.24.2008 at 01:05PM PDT, ID: 21196423
Sorry this was not for this question.
 
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628