Trying to sort a bunch of files numerically but can't seem to get the command just right. This is in a IBM AIX machine.
I have a directory that has...
There are a lot more files but this is shortened for the example.
If I simply do a ls -l on the directory I get..
I need the list to include the full directory path (in this case the files are stored in /usr1/temp) and the file name like this..
Anyone able to help me out?
Moderator's Comments:
Please use code tags, as required by forum rules.
Thanks!
Last edited by Peasant; 01-29-2020 at 11:45 AM..
Reason: Added code tags.
hello
i have a requirement where i have a direcotry in which i get files in the format
STOCKS.20080114.dat
STOCKS.20080115.dat
STOCKS.20080117.dat
STOCKS.20080118.dat
i need to loop through the directory and sort by create date descending order and i need to process the first file.
... (1 Reply)
Hi,
I need to sort all the files in a directory whilst retaining the originals. So if in the directory I have:
File1
File2
File3
I want to sort these files so that I would have:
File1
File1.sort
File2
File2.sort
File3
File3.sort
where I have added the .sort extension to show... (4 Replies)
Hi all.
I have 2 files like this:
f1
A 10
B 80
C 9
f2
A 11
B 700
C 10
What I want is the concatenation of the two files sorted by name (alphabetically) and size (numerically), so the result should be like this:
F3 (cat f1 f2 sorted)
A 10
A 11
B 80
B 700 (2 Replies)
hi there,
I have a directory which contents I can parse dynamically. I end up with a file list. I then want to display those files sorted by date, oldest files first. I have very very little PERL experience...Would anyone know how to do that ? Thanks in advance. (8 Replies)
I got a long list of file name.
My input:
data_1.txt
data_2.txt
data_3.txt
data_10.txt
data_21.txt
data_12.txt
data_4.txt
My desired output:
data_1.txt
data_2.txt
data_3.txt
data_4.txt
data_10.txt
data_12.txt
data_21.txt
Does anybody got idea how to archive it? (11 Replies)
Hi,
A basic query. In the example file below, I want to sort by column 1 and then by column 2 numerically. I have tried sort -k2n,1 file1 but while this sorts the columns in the correct order, it does not sort column 2 numerically. Any help would be much appreciated. Also, if you have time to... (3 Replies)
Greetings - I'm not necessarily new to bash scripting - I'm probably between beginner and intermediate, but I have something that I just cannot figure out after many attempts to find it. I have a file that is merely a list of many files, with their respective paths, and a branch path (ClearCase)... (5 Replies)
Hey Guys,
I am facing an annoying scenario, fewer times when I execute the sort command, it throws out on error saying that "No Space on available on /var/tmp/<temp file name>. May be it is set to /var/tmp directory. I was wondering, if I cant redirect the temporary file creation to any other... (3 Replies)
Hello all,
I have a list of file names in a text document where each file name consists of 4 letters and 3 numbers (for example MACR119). There are 48 file names in the document (they are not in alphabetical or numerical order). I would like to reorder the list of names so that the 48th name is... (3 Replies)
Discussion started by: MDeBiasse
3 Replies
LEARN ABOUT PHP
pg_connect
PG_CONNECT(3)PG_CONNECT(3)pg_connect - Open a PostgreSQL connectionSYNOPSIS
resource pg_connect (string $connection_string, [int $connect_type])
DESCRIPTION pg_connect(3) opens a connection to a PostgreSQL database specified by the $connection_string.
If a second call is made to pg_connect(3) with the same $connection_string as an existing connection, the existing connection will be
returned unless you pass PGSQL_CONNECT_FORCE_NEW as $connect_type.
The old syntax with multiple parameters $conn = pg_connect("host", "port", "options", "tty", "dbname") has been deprecated.
PARAMETERS
o $connection_string
- The $connection_string can be empty to use all default parameters, or it can contain one or more parameter settings separated by
whitespace. Each parameter setting is in the form keyword = value. Spaces around the equal sign are optional. To write an empty
value or a value containing spaces, surround it with single quotes, e.g., keyword = 'a value'. Single quotes and backslashes
within the value must be escaped with a backslash, i.e., ' and \. The currently recognized parameter keywords are: $host,
$hostaddr, $port, $dbname (defaults to value of $user), $user, $password, $connect_timeout, $options, $tty (ignored), $sslmode,
$requiressl (deprecated in favor of $sslmode), and $service. Which of these arguments exist depends on your PostgreSQL version.
The $options parameter can be used to set command line parameters to be invoked by the server.
o $connect_type
- If PGSQL_CONNECT_FORCE_NEW is passed, then a new connection is created, even if the $connection_string is identical to an exist-
ing connection.
RETURN VALUES
PostgreSQL connection resource on success, FALSE on failure.
EXAMPLES
Example #1
Using pg_connect(3)
<?php
$dbconn = pg_connect("dbname=mary");
//connect to a database named "mary"
$dbconn2 = pg_connect("host=localhost port=5432 dbname=mary");
// connect to a database named "mary" on "localhost" at port "5432"
$dbconn3 = pg_connect("host=sheep port=5432 dbname=mary user=lamb password=foo");
//connect to a database named "mary" on the host "sheep" with a username and password
$conn_string = "host=sheep port=5432 dbname=test user=lamb password=bar";
$dbconn4 = pg_connect($conn_string);
//connect to a database named "test" on the host "sheep" with a username and password
$dbconn5 = pg_connect("host=localhost options='--client_encoding=UTF8'");
//connect to a database on "localhost" and set the command line parameter which tells the encoding is in UTF-8
?>
SEE ALSO pg_pconnect(3), pg_close(3), pg_host(3), pg_port(3), pg_tty(3), pg_options(3), pg_dbname(3).
PHP Documentation Group PG_CONNECT(3)