Sponsored Content
Top Forums Shell Programming and Scripting Extract specific text from variable and put it into array Post 302698073 by rajkumarin on Saturday 8th of September 2012 02:12:28 AM
Old 09-08-2012
Code:
sed 's/;/\n/g' filename | sed 's/\[/\n\[/g' | grep -v '^\[' | sed 's/^ *//'


Last edited by Scott; 11-13-2012 at 12:47 AM.. Reason: Code tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

extract some specific text file urgent pls

i have a big text file . i want to create new file as extract some specific text from the big file i am using hp ux please help (2 Replies)
Discussion started by: reyazan
2 Replies

2. Shell Programming and Scripting

extract the lines between specific line number from a text file

Hi I want to extract certain text between two line numbers like 23234234324 and 54446655567567 How do I do this with a simple sed or awk command? Thank you. ---------- Post updated at 06:16 PM ---------- Previous update was at 05:55 PM ---------- found it: sed -n '#1,#2p'... (1 Reply)
Discussion started by: return_user
1 Replies

3. Shell Programming and Scripting

Extract lines of text based on a specific keyword

I regularly extract lines of text from files based on the presence of a particular keyword; I place the extracted lines into another text file. This takes about 2 hours to complete using the "sort" command then Kate's find & highlight facility. I've been reading the forum & googling and can find... (4 Replies)
Discussion started by: DionDeVille
4 Replies

4. UNIX for Advanced & Expert Users

bash/grep/awk/sed: How to extract every appearance of text between two specific strings

I have a text wich looks like this: clid=2 cid=6 client_database_id=35 client_nickname=Peter client_type=0|clid=3 cid=22 client_database_id=57 client_nickname=Paul client_type=0|clid=5 cid=22 client_database_id=7 client_nickname=Mary client_type=0|clid=6 cid=22 client_database_id=6... (3 Replies)
Discussion started by: Pioneer1976
3 Replies

5. Shell Programming and Scripting

Put output into an array

I'm trying to take the output of an environment that has multiple strings ex. # echo $SSH_CLIENT 192.168.1.1 57039 22 I need that IP... so I can set it to another environment. Thank you (3 Replies)
Discussion started by: adelsin
3 Replies

6. Shell Programming and Scripting

perl, put one array into many array when field is equal to sth

Hi Everyone, #!/usr/bin/perl use strict; use warnings; my @test=("a;b;qqq;c;d","a;b;ggg;c;d","a;b;qqq;c;d"); would like to split the @test array into two array: @test1=(("a;b;qqq;c;d","a;b;qqq;c;d"); and @test2=("a;b;ggg;c;d"); means search for 3rd filed. Thanks find the... (0 Replies)
Discussion started by: jimmy_y
0 Replies

7. Shell Programming and Scripting

Shell script to put delimiter for a no delimiter variable length text file

Hi, I have a No Delimiter variable length text file with following schema - Column Name Data length Firstname 5 Lastname 5 age 3 phoneno1 10 phoneno2 10 phoneno3 10 sample data - ... (16 Replies)
Discussion started by: Gaurav Martha
16 Replies

8. Shell Programming and Scripting

Extract text from file then write variable

I have a text file that has many lines, and for each line I need to extract different sections of text, then write several variables from the data. I can split out the various sections by selecting their position on each line as the column sizes will never vary. A sample of my text file is below... (2 Replies)
Discussion started by: kcpoole
2 Replies

9. Shell Programming and Scripting

Extract specific line in an html file starting and ending with specific pattern to a text file

Hi This is my first post and I'm just a beginner. So please be nice to me. I have a couple of html files where a pattern beginning with "http://www.site.com" and ending with "/resource.dat" is present on every 241st line. How do I extract this to a new text file? I have tried sed -n 241,241p... (13 Replies)
Discussion started by: dejavo
13 Replies

10. Shell Programming and Scripting

Passing specific and incrementing lines of text from file via variable

This is part of a larger script where I need to pass only 1 line of a file to the script, based on a variable and not a direct reference. As part of a for loop : # for((line=0;line<50;line++)); do # awk ‘NR==$line' PhraseList.txt; done ... (5 Replies)
Discussion started by: Seth
5 Replies
OCI_NEW_CONNECT(3)														OCI_NEW_CONNECT(3)

oci_new_connect - Connect to the Oracle server using a unique connection

SYNOPSIS
resource oci_new_connect (string $username, string $password, [string $connection_string], [string $character_set], [int $ses- sion_mode]) DESCRIPTION
Establishes a new connection to an Oracle server and logs on. Unlike oci_connect(3) and oci_pconnect(3), oci_new_connect(3) does not cache connections and will always return a brand-new freshly opened connection handle. This is useful if your application needs transactional isolation between two sets of queries. PARAMETERS
o $username - The Oracle user name. o $password - The password for $username. o $connection_string -Contains the Oracle instance to connect to. It can be an Easy Connect string, or a Connect Name from the tnsnames.ora file, or the name of a local Oracle instance. If not specified, PHP uses environment variables such as TWO_TASK (on Linux) or LOCAL (on Windows) and ORACLE_SID to determine the Oracle instance to connect to. To use the Easy Connect naming method, PHP must be linked with Oracle 10 g or greater Client libraries. The Easy Connect string for Oracle 10 g is of the form: [//]host_name[:port][/ser- vice_name]. From Oracle 11 g, the syntax is: [//]host_name[:port][/service_name][:server_type][/instance_name]. Service names can be found by running the Oracle utility lsnrctl status on the database server machine. The tnsnames.ora file can be in the Oracle Net search path, which includes $ORACLE_HOME/network/admin and /etc. Alternatively set TNS_ADMIN so that $TNS_ADMIN/tnsnames.ora is read. Make sure the web daemon has read access to the file. o $character_set -Determines the character set used by the Oracle Client libraries. The character set does not need to match the character set used by the database. If it doesn't match, Oracle will do its best to convert data to and from the database character set. Depending on the character sets this may not give usable results. Conversion also adds some time overhead. If not specified, the Oracle Client libraries determine a character set from the NLS_LANG environment variable. Passing this parameter can reduce the time taken to connect. o $session_mode -This parameter is available since version PHP 5 (PECL OCI8 1.1) and accepts the following values: OCI_DEFAULT, OCI_SYSOPER and OCI_SYSDBA. If either OCI_SYSOPER or OCI_SYSDBA were specified, this function will try to establish privileged connection using external credentials. Privileged connections are disabled by default. To enable them you need to set oci8.privileged_connect to On. PHP 5.3 (PECL OCI8 1.3.4) introduced the OCI_CRED_EXT mode value. This tells Oracle to use External or OS authentication, which must be configured in the database. The OCI_CRED_EXT flag can only be used with username of "/" and a empty password. oci8.privileged_connect may be On or Off. OCI_CRED_EXT may be combined with the OCI_SYSOPER or OCI_SYSDBA modes. OCI_CRED_EXT is not supported on Windows for security reasons. RETURN VALUES
Returns a connection identifier or FALSE on error. EXAMPLES
The following demonstrates how you can separate connections. Example #1 oci_new_connect(3) example <?php // create table mytab (mycol number); function query($name, $c) { echo "Querying $name "; $s = oci_parse($c, "select * from mytab"); oci_execute($s, OCI_NO_AUTO_COMMIT); $row = oci_fetch_array($s, OCI_ASSOC); if (!$row) { echo "No rows "; } else { do { foreach ($row as $item) echo $item . " "; echo " "; } while (($row = oci_fetch_array($s, OCI_ASSOC)) != false); } } $c1 = oci_connect("hr", "welcome", "localhost/orcl"); $c2 = oci_new_connect("hr", "welcome", "localhost/orcl"); $s = oci_parse($c1, "insert into mytab values(1234)"); oci_execute($s, OCI_NO_AUTO_COMMIT); query("basic connection", $c1); query("new connection", $c2); oci_commit($c1); query("new connection after commit", $c2); // Output is: // Querying basic connection // 1234 // Querying new connection // No rows // Querying new connection after commit // 1234 ?> See oci_connect(3) for further examples of parameter usage. SEE ALSO
oci_connect(3), oci_pconnect(3). PHP Documentation Group OCI_NEW_CONNECT(3)
All times are GMT -4. The time now is 01:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy