I have a perl script with an array of clients.
@arr = ("The ABC Corp", "AA Corp.", "BB Corp");
If I run
@a = sort (@arr);
I will get
@a = ("AA Corp", "BB Corp", "The ABC Corp");
but I want
@a = ("AA Corp, "The ABC Corp", "BB Corp");
How do I sort array without changing... (2 Replies)
Some one plz help me how to sort an array of hashes .....
for e.g i have an array as
@AoH = (
{
ques => 10,
marks => 32,
},
{
ques => 32,
marks => 22,
},
{
ques => 2,
marks => 41,
},
);
now i want to sort this array with increasing value of "ques" ..... plz... (3 Replies)
Hey
How do I sort an array numerically after the second column?
My values are integers like 1, 2, 3, 4... and they are not unique, so I can't just reverse my hash and sort by keys.
I wanna sort my file/array so that I get the lines with the highest value in the top - that is descending. ... (2 Replies)
Hi Everyone,
Any simple code can simplify the code below, please advice. Thanks
# cat 2.pl
#!/usr/bin/perl
use warnings;
use strict;
my @aaaaa = <DATA>;
my @uids;
foreach (@aaaaa) {
my @ccccc = split (",", $_);
push @uids, $ccccc;... (3 Replies)
Hi I'm just learning programming and need some help.
I've taken a data file which has a list of numbers eg:
3
5
32
533
13
2
And I've used sort -n and to sort and then piped it to awk to arrange into an array.
#!/bin/sh
sort -n data.txt |
awk '
{
array=$1
} (4 Replies)
Hi friends,
I have implemented the merge sort algorith in c, before I put forward my question, you please have a look at my code.
// The array is sorted, as 1234
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int A = {4, 3, 2, 1};
void Merge_Sort(int , int, int);
void... (0 Replies)
Hi,
input:
line1|error_type_a@15
line1|error_type_c@10
line1|error_type_b@5
line2|error_type_f@3
line2|error_type_a@1
I would need to place all the second fields with common first field on the same line, BUT with sorted error position number:
line1|error_type_b@5; error_type_c@10;... (5 Replies)
Hi there,
I'm listing files and sorting them. When I try to get length of array variable in which these files are stored I get 1 as value. That's weird.
files_info="$(find $input_dir -name "*_CHR$i.info" | sort )"
printf ${#files_info}"\n" #print length
#--loop through... (6 Replies)
Hello
I have a problem.
I create a Multidimensional Array Like this:
ENTRY="$kunnum-$host"
ENTRY="$host"
ENTRY="# $3"
for key in "${!ENTRY}"; do
ENTRIES=${ENTRY} # INDEX=IP(5)
donedeclare -p
declare -A ENTRIES=(="unas15533" ="unas" ="# RDP-Terminal 2"... (12 Replies)