Hi,
I have 24 .dat files something like below. The file name starts with “abc” followed by two digit month and two digit year. Is there a way to grab the month and year from each filename and append it to the end of each line. Once this is done I want to combine all the files into file... (1 Reply)
Hi,
I'm reading data from comma separated files to DB. Now there is a need to have the name of the input file in each row of that file. How can I do this in unix script?
Example:
$cat file1
value11,value12, value,13
value21,value22, value,23
value31,value32, value,33
And the result... (2 Replies)
Hi All,
I have named a file with current date,time and year as follows:
month=`date | awk '{print $2}'`
date=`date | awk '{print $3}'`
year=`date | awk '{print $6}'`
time=`date +%Hh_%Mm_%Ss'`
filename="test_"$month"_"$date"_"$year"_"$time".txt"
> $filename
The file is created with a... (2 Replies)
Hi all,
I am trying to write a script that will delete a certain amount of text from the end of a filename.
For example.
Input:
name of file (more text).pdf
Output:
name of file.pdf
So is it possible to write a script the deletes, in this example twelve (12) digits from the end... (6 Replies)
Hi all,
I have this basic script to remove, in this case 9 characters from the end of a file name. This is what I have so far,
for file in *.mov
do
newname=`echo $file | sed 's/\(.*\)........./\1/' `
mv "$file" "$newname"
done
The problem is that it removes the file extension as well.... (2 Replies)
Hi,
i have some files which looks like given below:
-rwxrwxrwx 1 amsbatch ams 1608 Oct 22 2009 AMS_BATCH_COMPILE*
-rwxr----- 1 amsbatch ams 1608 Oct 22 2009 AMS_BATCH_COMPILE_original*
-rwxrwxrwx 1 amsbatch ams 1127 Dec 1 2005 AMS_LMU.sh*
drwxr-xr-x 2... (3 Replies)
Hi all.. I have several unique files that contain one thing in common, and that is acct#. For all files in the directory, I want to append the 10 characters following the word "ACCOUNT:" to the end of the filename.
for example:
I have file 111_123 that contains ACCOUNT:ABC1234567
The file... (5 Replies)
Hi there
/root #yum localinstall sg3_utils
Loaded plugins: product-id, refresh-packagekit, subscription-manager
Updating Red Hat repositories.
Setting up Local Package Process
Skipping: sg3_utils, filename does not end in .rpm.
Nothing to do
/root #
above is the error
/root... (6 Replies)
Hi Guys,
I have serveral directories like this:
(2013) blablabla(blabla) - blabla (blabla)
or
(1997) blablabla(blabla) - blabla (blabla)
and have to rename them to something like that:
blablabla(blabla) - blabla (blabla) (2013)
and
blablabla(blabla) - blabla (blabla) (1997)
Easy... (2 Replies)
Hi ,
Please help me out for the below problem -
I have 2 files in a directory -
$ ls -ltr
total 4
-rwx------+ 1 abc Domain Users 615 May 31 17:33 abc.txt
-rwx------+ 1 abc Domain Users 0 May 31 17:33 ll.sh
I want to write the filename of abc.txt along with the directory to the... (2 Replies)
Discussion started by: Pratik4891
2 Replies
LEARN ABOUT PHP
cubrid_pconnect_with_url
CUBRID_PCONNECT_WITH_URL(3) 1 CUBRID_PCONNECT_WITH_URL(3)cubrid_pconnect_with_url - Open a persistent connection to CUBRID serverSYNOPSIS
resource cubrid_pconnect_with_url (string $conn_url, [string $userid], [string $passwd])
DESCRIPTION
Establishes a persistent connection to a CUBRID server.
cubrid_pconnect_with_url(3) acts very much like cubrid_connect_with_url(3) with two major differences.
First, when connecting, the function would first try to find a (persistent) link that's already open with the same host, port, dbname and
userid. If one is found, an identifier for it will be returned instead of opening a new connection.
Second, the connection to the SQL server will not be closed when the execution of the script ends. Instead, the link will remain open for
future use (cubrid_close(3) or cubrid_disconnect(3) will not close links established by cubrid_pconnect_with_url(3)).
This type of link is therefore called 'persistent'.
<url> ::= CUBRID:<host>:<db_name>:<db_user>:<db_password>:[?<properties>]
<properties> ::= <property> [&<property>]
<properties> ::= alhosts=<alternative_hosts>[ &rctime=<time>]
<properties> ::= login_timeout=<milli_sec>
<properties> ::= query_timeout=<milli_sec>
<properties> ::= disconnect_on_query_timeout=true|false
<alternative_hosts> ::= <standby_broker1_host>:<port> [,<standby_broker2_host>:<port>]
<host> := HOSTNAME | IP_ADDR
<time> := SECOND
<milli_sec> := MILLI SECOND
ohost : A host name or IP address of the master database
odb_name : A name of the database
odb_user : A name of the database user
odb_password : A database user password
o alhosts : Specifies the broker information of the standby server, which is used for failover when it is impossible to connect to
the active server. You can specify multiple brokers for failover, and the connection to the brokers is attempted in the order listed
in alhosts
o rctime : An interval between the attempts to connect to the active broker in which failure occurred. After a failure occurs, the
system connects to the broker specified by althosts (failover), terminates the transaction, and then attempts to connect to the
active broker of the master database at every rctime. The default value is 600 seconds.
o login_timeout : Timeout value (unit: msec.) for database login. The default value is 0, which means infinite postponement.
o query_timeout : Timeout value (unit: msec.) for query request. Upon timeout, a message to cancel requesting a query transferred to
server is sent. The return value can depend on the disconnect_on_query_timeout configuration; even though the message to cancel a
request is sent to server, that request may succeed.
o disconnect_on_query_timeout : Configures a value whether to immediately return an error of function being executed upon timeout.
The default value is false.
Note
? and : that are used as identifiers in PHP connection URL can't be included in the password. The following is an example of a pass-
word that is invalid to use as connection URL because it contains " ?:".
$url = "CUBRID:localhost:33000:tdb:dba:12?:?login_timeout=100";
Passwords that contain ? or : may be passed as a separate parameter.
$url = "CUBRID:localhost:33000:tbd:::?login_timeout=100";
$conn = cubrid_pconnect_with_url ($url, "dba", "12?");
If user or password is empty,you can't delete " :",the following is an example.
$url = "CUBRID:localhost:33000:demodb:::";
PARAMETERS
o $conn_url
-A character string that contains server connection information.
o $userid
-User name for the database.
o $passwd
-User password.
RETURN VALUES
Connection identifier, when process is successful.
FALSE, when process is unsuccessful.
EXAMPLES
Example #1
cubrid_pconnect_with_url(3) url without properties example
<?php
$conn_url = "CUBRID:127.0.0.1:33000:demodb:dba::"
$con = cubrid_pconnect_with_url ($conn_url);
if ($con) {
echo "connected successfully";
cubrid_execute($con, "create table person(id int,name char(16))");
$req =cubrid_execute($con, "insert into person values(1,'James')");
if ($req) {
cubrid_close_request ($req);
cubrid_commit ($con);
} else {
cubrid_rollback ($con);
}
cubrid_disconnect ($con);
}
?>
Example #2
cubrid_pconnect_with_url(3) url with properties example
<?php
$conn_url = "CUBRID:127.0.0.1:33000:demodb:dba::?althost=10.34.63.132:33088&rctime=100"
$con = cubrid_pconnect_with_url ($conn_url);
if ($con) {
echo "connected successfully";
$req =cubrid_execute($con, "insert into person values(1,'James')");
if ($req) {
cubrid_close_request ($req);
cubrid_commit ($con);
} else {
cubrid_rollback ($con);
}
cubrid_disconnect ($con);
}
?>
SEE ALSO cubrid_connect(3), cubrid_pconnect(3), cubrid_pconnect_with_url(3), cubrid_disconnect(3), cubrid_close(3).
PHP Documentation Group CUBRID_PCONNECT_WITH_URL(3)