Sponsored Content
Top Forums Shell Programming and Scripting Compare values of hashes of hash for n number of hash in perl without sorting. Post 302713123 by asak on Wednesday 10th of October 2012 09:55:54 AM
Old 10-10-2012
Error Compare values of hashes of hash for n number of hash in perl without sorting.

Hi,

I have an hashes of hash, where hash is dynamic, it can be n number of hash. i need to compare data_count values of all .
Code:
my %result (
		$abc => {
				 'data_count' => '10',
				 'ID'		  => 'ABC122',
				}
				
		$def => {
				 'data_count' => '20',
				 'ID'		  => 'defASe',
				 }
				 
		:
		:
		:
		
		$n	=> {
				 'data_count' => '20',
				 'ID'		  => 'nsnsn',
			   }
		);

I need to compare the data_count of each hashes of hash, i need to get greater data_count and ID and also lesser( minimum ) data_count and ID.

how to compare the hash values without sorting using perl.

Regards,
asak
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Print Entire hash list (hash of hashes)

I have a script with dynamic hash of hashes , and I want to print the entire hash (with all other hashes). Itried to do it recursively by checking if the current key is a hash and if yes call the current function again with refference to the sub hash. Most of the printing seems to be OK but in... (1 Reply)
Discussion started by: Alalush
1 Replies

2. Shell Programming and Scripting

perl hash of hashes from database

hi there, I have some database output that looks like this SELECT nic_name,nic_duplex,nic_speed,nic_ip FROM network_table WHERE hostname = "server1" result is this (ive delimited with a pipe for ease of reading) bge0|full|1000|10.32.100.1 bge1|full|1000|11.12.101.7 ... (1 Reply)
Discussion started by: hcclnoodles
1 Replies

3. Shell Programming and Scripting

PERL - printing a hash of hashes to screen

Hi there I have a hash of hashes made up of the following data bge0|100|half|10.36.100.21 bge1|1000|full|10.36.100.22 bge2|1000|full|10.36.100.23 which when i turn into a hash, would look like this inside the system bge0 -> nic_speed -> 100 nic_duplex -> half ... (6 Replies)
Discussion started by: hcclnoodles
6 Replies

4. Shell Programming and Scripting

PERL - another quick hash of hashes question

Hi, sorry, two hash related questions in one day .. but this has got me a bit stuck. I have a mysql database table that kind of looks like this, the table is called "view1" and a snippet of that table (SELECT'ing just rows with serial number 0629AN1200) is below serial nic_name ... (2 Replies)
Discussion started by: hcclnoodles
2 Replies

5. Shell Programming and Scripting

Perl Hash:Can not keep hash data in the same order that it was inserted

Can Someone explain me why even using Tie::IxHash I can not get the output data in the same order that it was inserted? See code below. #!/usr/bin/perl use warnings; use Tie::IxHash; use strict; tie (my %programs, "Tie::IxHash"); while (my $line = <DATA>) { chomp $line; my(... (1 Reply)
Discussion started by: jgfcoimbra
1 Replies

6. Shell Programming and Scripting

Sorting keys of a hash in perl

hi all, i have a small problem regarding sorting the keys in a hash. my %hash; for($i=0;$i<19;$i++) { $hash{$i}=$i; } foreach $c (sort keys %hash) { print "\n $hash{$c}"; } (1 Reply)
Discussion started by: niteesh_!7
1 Replies

7. Shell Programming and Scripting

perl: dereferencing a hash of hashes

Hi there, I am trying to dereference my hash of hashes but post dereferencing, it seems to lose its structure I am using Data::dumper to help me anaylise. This is the code im using to build the HoH, (data comes from a file). I have also performed a Dumper on the data structure before and after... (1 Reply)
Discussion started by: rethink
1 Replies

8. Shell Programming and Scripting

Perl: Sorting a hash value that is a list.

Hi Folks I am very much a newbie at perl but picking it up and I'm hoping you can help. I have a file input that details all the /etc/group files in our enterprise in the following format: "<host>:<group>:<gid>:<users>" I want to parse this data display it as the following:... (9 Replies)
Discussion started by: g_string
9 Replies

9. Shell Programming and Scripting

Sorting values of hash in ascending order using Perl

I want to sort values of a hash in ascending order. my %records; for my $value (sort values %records){print $value,"\n";} When I use the above code I get values in this order: 1,10,11,2,3,4,5,6,7,8,9. But, I need values in my output in this order: 1,2,3,4,5,6,7,8,9,10,11. Can Someone... (1 Reply)
Discussion started by: koneru_18
1 Replies

10. Shell Programming and Scripting

Perl hash of hashes anonymous array

Hello experts. I'm having problems with a snippet of code. I was hoping to get help/advice to correct. A file that this script parses has changed to the point where I can no longer use a scalar, it looks as though I need to create an array for a hash of hashes below. The first output of... (1 Reply)
Discussion started by: timj123
1 Replies
EFICHECK(8)						    BSD System Manager's Manual 					       EFICHECK(8)

NAME
eficheck -- check the integrity of the x86 flash chip firmware. SYNOPSIS
eficheck --integrity-check [-h EFI-hash-input-file] [-b EFI-binary-input-file] eficheck --show-hashes [-h EFI-hash-input-file] [-b EFI-binary-input-file] eficheck --generate-hashes [-h EFI-hash-output-file] [-p output-path] eficheck --save [-b EFI-binary-output-file] eficheck --cleanup [-b EFI-binary-input-and-output-file>] eficheck --version eficheck --help DESCRIPTION
eficheck is a tool to check the x86 flash chip firmware. The following commands can be used with eficheck: --integrity-check hashes portion of the firmware and compares against known-good hashes --generate-hashes outputs hashes for a given firmware to be used as known-good hashes --show-hashes shows the hashes for the sub-sections of the firmware which are measured --save saves the full flash chip contents to a binary file. Requires root privileges. --cleanup zeros any privacy-sensitive data (such as nvram), enabling the file to be shared for analysis. --version print out eficheck version number. --help display a short help. EXAMPLES
'eficheck --save -b firmware.bin' Save this system's EFI firmware as firmware.bin 'eficheck --cleanup -b firmware.bin' Overwrite the EFI variables portion of the firmware.bin, in place 'eficheck --generate-hashes' Analyze the current system's installed EFI firmware, and store the hashes into hash file(s) in current folder File name(s) will be selected according to image's EFI version(s) 'eficheck --generate-hashes -b firmware.bin' Analyze the firmware.bin, and store the hashes into hash file(s) in current folder. Filename will be based on the detected firmware version. 'eficheck --generate-hashes -p /usr/local/allowlists' Analyze the current system's installed EFI firmware, and store the hashes into hash file(s) in /usr/local/allowlists folder 'eficheck --integrity-check' Attempt to automatically determine which firmware you are running, and integrity check against the appropriate file, and report any differences 'eficheck --integrity-check -h /usr/libexec/firmwarecheckers/eficheck/EFIAllowListShipping.bun- dle/allowlists/IM171.88Z.0105.B08.1604111319.0.ealf' Compare the current system's EFI firmware against the Apple-provided expected measurements for an "iMac17,1" at firmware revision B08, and report any differences 'eficheck --integrity-check -h hash.ealf -b firmware.bin' Compare the given hash file against against the given firmware image and report any differences 'eficheck --show-hashes' Print the hashes for the current system's installed EFI firmware to stdout 'eficheck --show-hashes -b firmware.bin' Print the hashes for the given firmware.bin to stdout 'eficheck --show-hashes -h IM171.88Z.0105.B08.1604111319.0.ealf' Print the hashes for the given allowlist to stdout May 25, 2017
All times are GMT -4. The time now is 05:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy