08-28-2009
separating comma delimited words
Hi,
I have file with text
________________________________
GROUP:firstname1.lastname1,first_name2.last_name2,first_name3.last_name3
HEAD:firstname.lastname
________________________________
I need help to pick the names separately ie..
Need out put
as
var1 =firstname1.lastname1
Var2=first_name2.last_name2
..
var n=firstname.lastname
or keep them in a array
array[names]
Please help
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
Can anyone let me know on how to convert a Tab delimited file to Comma delimited file in Unix
Thanks!! (22 Replies)
Discussion started by: charan81
22 Replies
2. Shell Programming and Scripting
I have a folder that contains say 50 files in a sequential order:
cdf_1.txt
cdf_2.txt
cdf_3.txt
cdf_3.txt
.
.
.
cdf_50.txt.
I need to merge these files in the same order into a single tab delimited file.
I used the following shell script:
for x in {1..50};
do cat cdf_${x}.txt >>... (3 Replies)
Discussion started by: Lucky Ali
3 Replies
3. Shell Programming and Scripting
I have a file with the contents below
jan_t=jan;feb_t=feb;mar_t=mar;year=2010
jan_t=null;feb_t=feb;mar_t=mar;year=2010
jan_t=jan;feb_t=feb;mar_t=mar;year=2010
I want to extract out all the fields values ending with "_t" , however, i want to exclude feb_t and mar_t from the results
In... (6 Replies)
Discussion started by: alienated
6 Replies
4. Shell Programming and Scripting
Hi,
I am having source (Oracle) as given below.
SourceOBJECT_NAMESUBOBJECT_NAMEOBJECT_IDDATA_OBJECT_IDOBJECT_TYPECREATEDLAST_DDL_TIMESTAMPSTATUSTGSTEST 336559336559TABLE4/15/2009 10:374/15/2009 10:372009-04-15:10:37:57VALIDNNNUNIX 336559336559TABLE4/15/2009 10:374/15/2009... (3 Replies)
Discussion started by: arunvasu2
3 Replies
5. Shell Programming and Scripting
Hi all,
I'm trying to get a bash script working for a program (bowtie) which takes a list of input files (*.fastq) and assembles them to an output file (outfile.sam). All the .fastq files are in one folder in my home directory (~/infiles).
The problem is that the 'bowtie' requires that... (7 Replies)
Discussion started by: TuAd
7 Replies
6. Shell Programming and Scripting
Hi All,
I need a unix script to convert .csv files to .skv files (changing a comma delimited file to a semi colon delimited file). I am a unix newbie and so don't know where to start. The script will be scheduled using cron and needs to convert each .csv file in a particular folder to a .skv... (4 Replies)
Discussion started by: CarpKing
4 Replies
7. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Hi Guys,
I am new on the scripting world and would like ask for help if you can.
Here are my questions... (1 Reply)
Discussion started by: mahiwaga
1 Replies
8. Shell Programming and Scripting
Hi
I have the following file
# cat red
it.d-state = 50988 41498 45 0 0 0
it.age_buffer= 1500
it.dir = 1
I need to grep lines that are present after "="
But when I do so, few lines has more than one value and some has one
How to parse the line
I have used the follwing... (6 Replies)
Discussion started by: Priya Amaresh
6 Replies
9. Shell Programming and Scripting
Hi,
I am wanting to create a script that will construct a SQL statement based on a a space delimited string that it read from a config file.
Example of the SQL will be
For example, it will read a string like "AAA BBB CCC" and assign to a variable named IN_STRING.
I then concatenate... (2 Replies)
Discussion started by: newbie_01
2 Replies
10. Shell Programming and Scripting
I have a large database with the following structure:
Indicword,Indicword,Indicword=English
on a line.
Not all lines will have this structure. Some might have a single word mapping to a single word in Indic.
An example will make this clear
... (4 Replies)
Discussion started by: gimley
4 Replies
LEARN ABOUT PHP
cubrid_query
CUBRID_QUERY(3) 1 CUBRID_QUERY(3)
cubrid_query - Send a CUBRID query
SYNOPSIS
resource cubrid_query (string $query, [resource $conn_identifier])
DESCRIPTION
cubrid_query(3) sends a unique query (multiple queries are not supported) to the currently active database on the server that's associated
with the specified $conn_identifier.
PARAMETERS
o $query
- An SQL query Data inside the query should be properly escaped.
o $conn_identifier
- The CUBRID connection. If the connection identifier is not specified, the last connection opened by cubrid_connect(3) is
assumed.
RETURN VALUES
For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returning resultset, cubrid_query(3) returns a resource on success, or FALSE on
error.
For other type of SQL statements, INSERT, UPDATE, DELETE, DROP, etc, cubrid_query(3) returns TRUE on success or FALSE on error.
The returned result resource should be passed to cubrid_fetch_array(3), and other functions for dealing with result tables, to access the
returned data.
Use cubrid_num_rows(3) to find out how many rows were returned for a SELECT statement or cubrid_affected_rows(3) to find out how many rows
were affected by a DELETE, INSERT, REPLACE, or UPDATE statement.
cubrid_query(3) will also fail and return FALSE if the user does not have permission to access the table(s) referenced by the query.
EXAMPLES
Example #1
Invalid Query
The following query is syntactically invalid, so cubrid_query(3) fails and returns FALSE.
<?php
$conn = cubrid_connect('localhost', 33000, 'demodb');
$result = cubrid_query('SELECT * WHERE 1=1');
if (!$result) {
die('Invalid query: ' . cubrid_error());
}
?>
Example #2
Valid Query
The following query is valid, so cubrid_query(3) returns a resource.
<?php
// This could be supplied by a user, for example
$firstname = 'fred';
$lastname = 'fox';
$conn = cubrid_connect('localhost', 33000, 'demodb');
cubrid_execute($conn,"DROP TABLE if exists friends");
cubrid_execute($conn,"create table friends(firstname varchar,lastname varchar,address char(24),age int)");
cubrid_execute($conn,"insert into friends values('fred','fox','home-1','20')");
cubrid_execute($conn,"insert into friends values('blue','cat','home-2','21')");
// Formulate Query
// This is the best way to perform an SQL query
// For more examples, see cubrid_real_escape_string()
$query = sprintf("SELECT firstname, lastname, address, age FROM friends WHERE firstname='%s' AND lastname='%s'",
cubrid_real_escape_string($firstname),
cubrid_real_escape_string($lastname));
// Perform Query
$result = cubrid_query($query);
// Check result
// This shows the actual query sent to CUBRID, and the error. Useful for debugging.
if (!$result) {
$message = 'Invalid query: ' . cubrid_error() . "
";
$message .= 'Whole query: ' . $query;
die($message);
}
// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the cubrid result functions must be used
// See also cubrid_result(), cubrid_fetch_array(), cubrid_fetch_row(), etc.
while ($row = cubrid_fetch_assoc($result)) {
echo $row['firstname'];
echo $row['lastname'];
echo $row['address'];
echo $row['age'];
}
// Free the resources associated with the result set
// This is done automatically at the end of the script
cubrid_free_result($result);
?>
SEE ALSO
cubrid_connect(3), cubrid_error(3), cubrid_real_escape_string(3), cubrid_result(3), cubrid_fetch_assoc(3), cubrid_unbuffered_query(3).
PHP Documentation Group CUBRID_QUERY(3)