Hello All,
I have log file the result from a multithreaded process. So when a process finishes it will write to this log file as 123 rows merged.
The issue is sometimes the processess finish at the same time or write to the file at the same time as
123 rows merged.145 rows merged.
At... (5 Replies)
If we assume that each line between the {} container is an XML document then What I want to remove the newline character from all lines within each container to have one XMDL document per line I wrote a bit of sed after trawling the web:
e.g.
#!/bin/sed -nf
H
/}/ {
x
s/\n//g
p... (3 Replies)
Hi,
I have the following XML not well-indented code:
<hallo
>this is a line
</hallo>
So I need to remove the newline.
This syntax finds what I need to correct, but I don't know how to remove the newline after my pattern:
sed 's/<.*$/&/'
How can I subtract the newline after my... (1 Reply)
Hi,
I have a fixed width file with record length 10.
I need to remove multiple newline characters present in each record.
EX:
af\n72/7\n
s\n3\nad\n
2\n\n33r\n
In the above file I want to remove new lines in red color(\n) but not (\n)
Please provide me a solution.
Thanks,
Sri (1 Reply)
Hi,
I have input file contains sql queries i need to eliminate newlines from it.
when i open it vi text editor and runs
:%s/'\n/'/g
it provides required result. but when i run sed command from shell prompt it doesn't impact outfile is still same as inputfile.
shell] sed -e... (6 Replies)
I have a file (test.dat) which contains data like this
459|199811047|a |b |shan
kar|ooty|
460|199811047|a |bv |gur
u|cbe|
but I need it like:
459|199811047|a |b |shankar|ooty|
460|199811047|a |b |guru|cbe|
While reading the data from this file, I don't want to remove newline from the end of... (4 Replies)
awk , sed Experts,
I want to remove first and last line after pattern match "vg" :
I am trying : # sed '1d;$d' works fine , but where the last line is not having vg entry it is deleting one line of data.
- So it should check for the pattern vg if present , then it should delete the line ,... (5 Replies)
Hi,
I've been trying to work out how to add a new line to a file when the pattern matches .dmg.
I've been searching Google but yet not found a working solution.
Help would be appreciated... (9 Replies)
For a given string that may contain any ASCII chars, i.e. that matches .*,
find and print only the chars that are in a given subset.
The string could also have numbers, uppercase, special chars such as ~!@#$%^&*(){}\", whatever a user could type in
without going esoteric
For simplicity take... (1 Reply)
Discussion started by: naderra
1 Replies
LEARN ABOUT DEBIAN
dbix::dbstag::sqltemplate
DBIx::DBStag::SQLTemplate(3pm) User Contributed Perl Documentation DBIx::DBStag::SQLTemplate(3pm)NAME
DBIx::DBStag::SQLTemplate - A Template for an SQL query
SYNOPSIS
# find template by name
$template = $dbh->find_template("mydb-personq");
# execute this template, filling in the 'name' attribute
$xml = $dbh->selectall_xml(-template=>$template,
-bind=>{name => "fred"});
DESCRIPTION
A template represents a canned query that can be parameterized.
Templates are collected in directories (in future it will be possible to store them in files or in the db itself).
To tell DBStag where your templates are, you should set:
setenv DBSTAG_TEMPLATE_DIRS "$HOME/mytemplates:/data/bioconf/templates"
Your templates should end with the suffix .stg, otherwise they will not be picked up
You can name templates any way you like, but the standard way is to use 2 or 3 fields
SCHEMA-OBJECT
or
SCHEMA-OBJECT-QUALIFIERS
(with underscores used within fields)
A template file should contain at minimum some SQL; for example:
Example template 1
SELECT
studio.*,
movie.*,
star.*
FROM
studio NATURAL JOIN
movie NATURAL JOIN
movie_to_star NATURAL JOIN
star
WHERE
[movie.genre = &genre&] [star.lastname = &lastname&]
USE NESTING (set(studio(movie(star))))
Thats all! However, there are ways to make your template more useful
Example template 2
:SELECT
studio.*,
movie.*,
star.*
:FROM
studio NATURAL JOIN
movie NATURAL JOIN
movie_to_star NATURAL JOIN
star
:WHERE
[movie.genre = &genre&] [star.lastname = &lastname&]
:USE NESTING (set(studio(movie(star))))
//
schema: movie
desc: query for fetching movies
By including : at the beginning it makes it easier for parsers to assemble SQL (this is not necessary for DBStag however)
After the // you can add tag: value data.
You should set schema: if you want the template to be available to users of a db that conforms to that schema
GETTING A TEMPLATE
The DBIx::DBStag object gives various methods for fetching templates by name, by database or by schema
VARIABLES
WHERE clause variables in the template look like this
&foo&
variables are bound at query time
my $set = $dbh->selectall_stag(-template=>$t,
-bind=>["bar"]);
or
my $set = $dbh->selectall_stag(-template=>$t,
-bind=>{foo=>"bar"});
If the former is chosen, variables are bound from the bind list as they are found
OPTIONAL BLOCKS
WHERE [ foo = &foo& ]
If foo is not bound then the part between the square brackets is left out
Multiple option blocks are ANDed together
An option block need not contain a variable - if it contains no &variable& name it is automatically ANDed
BINDING OPERATORS
The operator can be bound at query time too
WHERE [ foo => &foo& ]
Will become either
WHERE foo = ?
or
WHERE foo LIKE ?
or
WHERE foo IN (f0, f1, ..., fn)
Depending on whether foo contains the % character, or if foo is bound to an ARRAY
METHODS
name
Usage - $name = $template->name
Returns - str
Args -
every template has a name that (should) uniquely identify it
desc
Usage - $desc = $template->desc
Returns - str
Args -
templates have optional descriptions
get_varnames
Usage - $varnames = $template->get_varnames
Returns - listref of strs
Args -
Returns the names of all variable used in this template
WEBSITE
<http://stag.sourceforge.net>
AUTHOR
Chris Mungall <cjm@fruitfly.org>
COPYRIGHT
Copyright (c) 2003 Chris Mungall
This module is free software. You may distribute this module under the same terms as perl itself
perl v5.12.4 2010-02-01 DBIx::DBStag::SQLTemplate(3pm)