11-24-2015
How about prepending { read X; echo $X; sort; } < file | ?
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I have been looking for info on how to aggregate 2 ore 3 NIC's into into one big pipe. Any advice would be appreciated.
-Chuck (4 Replies)
Discussion started by: 98_1LE
4 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I have a file containing the following data:
junk123junk723itemcode001qty01price10total10junkjunk
junk123junk723itemcode002qty02price10total20junkjunk
..
..
..
could be 5000+ lines
I have an algo and need a code to implement this:
1. Linecount = wc -l (should give 5000)
2. For i... (1 Reply)
Discussion started by: shiroh_1982
1 Replies
3. UNIX Desktop Questions & Answers
Hello how are you, i have a question i have a file ale.log and i want to agregate a title and later a space when the text is over and put another title (when the text is over) how can i do this? thank you
Example
Last ------>(Title) i want to agregate
pupu pupu pupu pupu... (1 Reply)
Discussion started by: enkei17
1 Replies
4. UNIX for Advanced & Expert Users
Hy all,
I have a problem...can some one help me...
I have a file of records sort:
30|239|ORD|447702936929 |blackberry.net |20080728|141304|00000900|2|0000000000000536|28181|0000000006|0000000001|10|1
30|239|ORD|447702936929 |blackberry.net ... (4 Replies)
Discussion started by: anaconga
4 Replies
5. IP Networking
Hi
I have a question related to load balancing.I have two separate internet connections with 2Mbps speed and i would like to aggregate this two connections intro one connection with 4Mbps.Is it possible to do that, to put a Linux or Unix machine as a gateway?I read some stuff to split the... (3 Replies)
Discussion started by: tafil
3 Replies
6. Shell Programming and Scripting
file 1:
70|236|PPS|0501011818|mms|20090706|001452|00000024|2|0000000000000000|00000|0000000000|0000000000|40948000|1
70|236|PPS|0501020076|mms|20090705|204408|00000019|2|0000000000000000|00000|0000000000|0000000000|40947930|1... (3 Replies)
Discussion started by: magedfawzy
3 Replies
7. Shell Programming and Scripting
Hi experts,
I need an help on the task below.
INPUT: values separated by the tab,first row is the header
20110609 AS A 300.5000
20110609 AS R 200.5000
20110609 BR A 111.5000
20110609 BR R 222.5000
20110610 AS A 100.5500
20110610 AS ... (2 Replies)
Discussion started by: hernand
2 Replies
8. Shell Programming and Scripting
Hi all,
I have a problem where i'm trying to identify on which remote hosts the apps are running, ssh into it and restart them.
In case more than 1 apps is running on same remote host, i want to be able to group it and ssh only once.
E.g:
app1 = 1.1.1.1
app2 = 1.1.1.2
app3 =... (4 Replies)
Discussion started by: varu0612
4 Replies
9. Solaris
hi all,
i start with solaris 11 and i am disapointed by the change on ip managing.
i want to set a ipmp over tow aggregate but i dont find any doc and i am lost with the new commande
switch1
net0 aggregate1 |
net1 aggregate1 |-----|
|... (1 Reply)
Discussion started by: sylvain
1 Replies
SORT(3) 1 SORT(3)
sort - Sort an array
SYNOPSIS
bool sort (array &$array, [int $sort_flags = SORT_REGULAR])
DESCRIPTION
This function sorts an array. Elements will be arranged from lowest to highest when this function has completed.
PARAMETERS
o $array
- The input array.
o $sort_flags
- The optional second parameter $sort_flags may be used to modify the sorting behavior using these values: Sorting type flags:
o SORT_REGULAR - compare items normally (don't change types)
o SORT_NUMERIC - compare items numerically
o SORT_STRING - compare items as strings
o SORT_LOCALE_STRING - compare items as strings, based on the current locale. It uses the locale, which can be changed using
setlocale(3)
o SORT_NATURAL - compare items as strings using "natural ordering" like natsort(3)
o SORT_FLAG_CASE - can be combined (bitwise OR) with SORT_STRING or SORT_NATURAL to sort strings case-insensitively
RETURN VALUES
Returns TRUE on success or FALSE on failure.
CHANGELOG
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
| 5.4.0 | |
| | |
| | Added support for SORT_NATURAL and |
| | SORT_FLAG_CASE as $sort_flags |
| | |
| 5.0.2 | |
| | |
| | Added SORT_LOCALE_STRING |
| | |
+--------+---------------------------------------------------+
EXAMPLES
Example #1
sort(3) example
<?php
$fruits = array("lemon", "orange", "banana", "apple");
sort($fruits);
foreach ($fruits as $key => $val) {
echo "fruits[" . $key . "] = " . $val . "
";
}
?>
The above example will output:
fruits[0] = apple
fruits[1] = banana
fruits[2] = lemon
fruits[3] = orange
The fruits have been sorted in alphabetical order.
Example #2
sort(3) example using case-insensitive natural ordering
<?php
$fruits = array(
"Orange1", "orange2", "Orange3", "orange20"
);
sort($fruits, SORT_NATURAL | SORT_FLAG_CASE);
foreach ($fruits as $key => $val) {
echo "fruits[" . $key . "] = " . $val . "
";
}
?>
The above example will output:
fruits[0] = Orange1
fruits[1] = orange2
fruits[2] = Orange3
fruits[3] = orange20
The fruits have been sorted like natcasesort(3).
NOTES
Note
This function assigns new keys to the elements in $array. It will remove any existing keys that may have been assigned, rather than
just reordering the keys.
Note
Like most PHP sorting functions, sort(3) uses an implementation of Quicksort. The pivot is chosen in the middle of the partition
resulting in an optimal time for already sorted arrays. This is however an implementation detail you shouldn't rely on.
Warning
Be careful when sorting arrays with mixed types values because sort(3) can produce unpredictable results.
SEE ALSO
asort(3), The comparison of array sorting functions.
PHP Documentation Group SORT(3)