Im on HP/UX and am trying to find the command like an ll but that will sort showing the most currently modified programs first.
Can anyone help me with that? :cool: (2 Replies)
Dear All,
I have below attached file in which i have many nos, i want the last ascending order nos. The brief description is given below.
File
315
381
432
315
381
432
315
381
432
315
381
432
315
381
432 (6 Replies)
hi all
i want to remove some descending order number
example :
1 100 200 135.00 Gk_wirs 1
1 100 200 136.00 Gk_wirs 50
1 110 210 138.00 Gk_wirs 60
1 100 200 136.00 Gk_wirs 57 ----> how to remove... (6 Replies)
Hi,
I am trying to sort the following file in descending order of its fourth column.
2 1 363828 -2.423225e-03
3 1 363828 4.132763e-03
3 2 363828 8.150133e-03
4 1 363828 4.126890e-03
I use
sort -k4,4g -r input.txt > output.txt ... (1 Reply)
Hi,
I need to list files in ascending order. Filenames are in format inpTDT_1, inpTDT_2, inpTDT_3 and so on.
I want to list them in the ascending order based on the digit after underscore and send the output to a file.
Please help (5 Replies)
Hi,
I have a problem . I have few directories like inpTDT_1, inpTDT_2, inpTDT_3 and so on inside HOME directory . In one of my perl script (which is in my HOME), the above directories like inpTDT_1, inpTDT_2, inpTDT_3 are sorting out in an order So I wanted to sort all the inpTDT_1, inpTDT_2,... (1 Reply)
Hello,
I am running ubuntu 16.04 and trying to list all files inside a directory, I need to sort them in ascending order. While surfing on the site, I found an old thread but somehow it did not work.
Link
Ascending order with sort -nk2 myfile.txt command gives below output:
file... (5 Replies)
Discussion started by: baris35
5 Replies
LEARN ABOUT PHP
dbx_compare
DBX_COMPARE(3) 1 DBX_COMPARE(3)dbx_compare - Compare two rows for sorting purposesSYNOPSIS
int dbx_compare (array $row_a, array $row_b, string $column_key, [int $flags = DBX_CMP_ASC | DBX_CMP_NATIVE])
DESCRIPTION dbx_compare(3) is a helper function for dbx_sort(3) to ease the make and use of the custom sorting function.
PARAMETERS
o $row_a
- First row
o $row_b
- Second row
o $column_key
- The compared column
o $flags
- The $flags can be set to specify comparison direction:
o DBX_CMP_ASC - ascending order
o DBX_CMP_DESC - descending order
and the preferred comparison type:
o DBX_CMP_NATIVE - no type conversion
o DBX_CMP_TEXT - compare items as strings
o DBX_CMP_NUMBER - compare items numerically
One of the direction and one of the type constant can be combined with bitwise OR operator (|).
RETURN VALUES
Returns 0 if the row_a[$column_key] is equal to row_b[$column_key], and 1 or -1 if the former is greater or is smaller than the latter
one, respectively, or vice versa if the $flag is set to DBX_CMP_DESC.
EXAMPLES
Example #1
dbx_compare(3) example
<?php
function user_re_order($a, $b)
{
$rv = dbx_compare($a, $b, "parentid", DBX_CMP_DESC);
if (!$rv) {
$rv = dbx_compare($a, $b, "id", DBX_CMP_NUMBER);
}
return $rv;
}
$link = dbx_connect(DBX_ODBC, "", "db", "username", "password")
or die("Could not connect");
$result = dbx_query($link, "SELECT id, parentid, description FROM table ORDER BY id");
// data in $result is now ordered by id
dbx_sort($result, "user_re_order");
// date in $result is now ordered by parentid (descending), then by id
dbx_close($link);
?>
SEE ALSO dbx_sort(3).
PHP Documentation Group DBX_COMPARE(3)