01-30-2011
Multidimensional arrays and sort.
My language is C++. I have a multidimensional vector that I would like to sort by a specific "cell" or "field" within the main vector. Does anyone have any information on how to do this? I have searched all over the internet and every reference manual I can find. So far I have found very little to no information on this topic.
Thank you
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a file that's logically in the form of a multidimensional array with an unknown number of records in the file. The file looks like this:
name1
data1
name2
data2
name3
data3
...
nameN
dataN
How do I load this file into an array for processing, while... (2 Replies)
Discussion started by: leslie02
2 Replies
2. Shell Programming and Scripting
Hello All,
Here is my input file content and i am trying to write an awk file that produces the output as shown below. i tried with my little knowledge but was not successful.
Input File content:
ID COL1 COL2 COL3
1002 1 val21 val31
1002 2 val22 val32
1002 3 val23 val33... (2 Replies)
Discussion started by: forumthreads
2 Replies
3. Shell Programming and Scripting
i'm trying to use awk to count a listing similar to the following and get a report of the listing similar to the one below it.
y,pizza
n,pizza
y,pizza
y,pizza
n,tomato
n,tomato
y,cheese
y,cheese
n,cheese
report
----
pizza,3,1
tomato,0,2
cheese,2,1 (1 Reply)
Discussion started by: multimulti
1 Replies
4. Shell Programming and Scripting
Hi, I hope the title does not scare people to look into this thread but it describes roughly what I'm trying to do. I need a solution in PHP.
I'm a programming beginner, so it might be that the approach to solve this, might be easier to solve with an other approach of someone else, so if you... (0 Replies)
Discussion started by: lowmaster
0 Replies
5. Programming
if i declare both but don't input any variables what values will the int array and file pointer array have on default, and if i want to reset any of the elements of both arrays to default, should i just set it to 0 or NULL or what? (1 Reply)
Discussion started by: omega666
1 Replies
6. Shell Programming and Scripting
Hi Experts,
I'm a newbie.....multidimensional arrays in shell scripts is possible???
If so, can anyone guide me with an example.....and also can anyone tell me, how we can create a table like ouput format in shell script....the output should look like this one:
1 2 3 4 5 6
6 5 4 3... (4 Replies)
Discussion started by: kritibalu
4 Replies
7. Shell Programming and Scripting
Hi
How do I sort two arrays in a ascending order? I'm just doing this to teach myself a book my dad got me on unix.
The arrays are A and B and both are including values taken from a file input by the user.
How do I arrange the contents of both arrays so that they are both ordered from... (3 Replies)
Discussion started by: razrnaga
3 Replies
8. Shell Programming and Scripting
I have two files:
file-1 is a list of number of interfaces in the switch and file-2 have VLAN-ID , VLAN-NAME , Interface belong to that VLAN like this:
file-1:
1/1
1/2
1/3
1/4
1/5
.
.
file-2:
1,"vlan-wifi",1/1,1/7,1/8 (9 Replies)
Discussion started by: SULTAN01
9 Replies
9. Shell Programming and Scripting
I am learning about bash system variables, such as $ , @ and #.
I have this piece of script implementing an array and it is doing its job just fine.
This is not the only array I will be using.
Just for ease of maintenance and more coding I would like to have the arrays in two dimensional... (4 Replies)
Discussion started by: annacreek
4 Replies
10. Shell Programming and Scripting
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)
Discussion started by: Marti95
12 Replies
SORT(1) General Commands Manual SORT(1)
NAME
sort - sort a file of ASCII lines
SYNOPSIS
sort [-bcdfimnru] [-tc] [-o name] [+pos1] [-pos2] file ...
OPTIONS
-b Skip leading blanks when making comparisons
-c Check to see if a file is sorted
-d Dictionary order: ignore punctuation
-f Fold upper case onto lower case
-i Ignore nonASCII characters
-m Merge presorted files
-n Numeric sort order
-o Next argument is output file
-r Reverse the sort order
-t Following character is field separator
-u Unique mode (delete duplicate lines)
EXAMPLES
sort -nr file # Sort keys numerically, reversed
sort +2 -4 file # Sort using fields 2 and 3 as key
sort +2 -t: -o out # Field separator is :
sort +.3 -.6 # Characters 3 through 5 form the key
DESCRIPTION
Sort sorts one or more files. If no files are specified, stdin is sorted. Output is written on standard output, unless -o is specified.
The options +pos1 -pos2 use only fields pos1 up to but not including pos2 as the sort key, where a field is a string of characters delim-
ited by spaces and tabs, unless a different field delimiter is specified with -t. Both pos1 and pos2 have the form m.n where m tells the
number of fields and n tells the number of characters. Either m or n may be omitted.
SEE ALSO
comm(1), grep(1), uniq(1).
SORT(1)