04-24-2008
Creating an sql statement from a file. Problem with '
Hi, I am trying to create sql statements from a file, but I have a problem with ':
This is what I do:
cat filex.txt | awk -F: '{print $1,"A","and personnavn like",$5}' | sed -e "s/^/select bruker.brukernavn, person.personnavn from bruker, person where brukernavn like '/" -e "s/$/' and bruker.person=person.id;/"
The output from this is:
select bruker.brukernavn, person.personnavn from bruker, person where brukernavn like 'xxx A and personnavn like XX XXXX' and bruker.person=person.id;
What I would like to have is:
select bruker.brukernavn, person.personnavn from bruker, person where brukernavn like 'xxx' and personnavn like 'XX XXXX' and bruker.person=person.id;
I am trying something like this:
cat filex.txt | awk -F: '{print $1,"\' and personnavn like \'",$5}' | sed -e "s/^/select bruker.brukernavn, person.personnavn from bruker, person where brukernavn like '/" -e "s/$/' and bruker.person=person.id;/"
But no ....
10 More Discussions You Might Find Interesting
1. HP-UX
Hi all,
I need to bring the message to log file.Teradat/Hp-Ux
script:
-----
### Update Log Table
bteq <<- EOC
.run file ${SRC_DATA}/logon.txt
.run file ${SRC_DATA}/dbstagebteq.txt
.set format off
.set foldline off all
.set sidetitles off
... (1 Reply)
Discussion started by: vsubbu1000
1 Replies
2. Shell Programming and Scripting
Hi,
I need help urgently for following issue. Pls help me to resolve this issue.
I am calling sql script file(file1.sql) from UNIX Shell Script(script1.ksh) using sql plus and trying to create flat file that contains all records returned from SQL query in SQL script(file1.sql)
I given... (6 Replies)
Discussion started by: praka
6 Replies
3. Shell Programming and Scripting
Hello
I'm hoping someone may be able to help. I'm absolutely brand new to these shell scripts and have tried to bash bits together from the little learnt but my final script still doesn't work. Sorry if something similar is already posted but couldn't find anything existing close enough to help... (1 Reply)
Discussion started by: Dan27
1 Replies
4. Shell Programming and Scripting
Hi,
How to execute sql statements from the .sh file ??
Means, when we run .sh file then the sql statements within it should be get executed one by one from the sqlplus
With Regards (3 Replies)
Discussion started by: milink
3 Replies
5. Shell Programming and Scripting
Hello,
I don't understand why the script below doesn't act the way it should :
#!/bin/sh
awk 'BEGIN{printf("Entrez la date : "); getline date < "-"}
$0 ~ date {f=1;print;next}
/^{2}\//{f=0}
f' Planning.csv > planning.txt
It doesn't create file planning.txt with only the result of... (14 Replies)
Discussion started by: freyr
14 Replies
6. Shell Programming and Scripting
Hi friends,
I would like to get some help on the following requirement. I have a SQL file with following things,
select 1 from dual;
select user from dual;
select sysdate
from
dual;
BEGIN
PL/SQL Code
END;
/
This file will be saved as sql file. When I run my expected shell script,... (1 Reply)
Discussion started by: ssnair
1 Replies
7. Shell Programming and Scripting
I am new in shell scripting. currently i am using cygwin. My problem is
i created a profile file in my own folder. file name is first.profile in which i gave following values to variable
export a=10
now i am executing this profile file by below command
./.first.profile
it executed... (4 Replies)
Discussion started by: pratikjain998
4 Replies
8. UNIX for Dummies Questions & Answers
Hello,
I have a script to get the information from database, however, it's look like the loop is not work, can someone help? :confused:
echo Input file list to check:
read filelist
for file in 'cat $filelist.txt'
do
echo "select FILENAME from FILE_TABLE where filename like '${file}'%;" >>... (9 Replies)
Discussion started by: happyv
9 Replies
9. UNIX for Dummies Questions & Answers
Hi guys,
I am not experienced with Unix, so please dont mind if the question seem to be irrelevant.
I have written a simple script, that connects DB & fetches few records from a table. I wanted to get those details as file in .CSV format via mail.
-I stored the query o/p in a file.
-I... (6 Replies)
Discussion started by: sumitburnwal88
6 Replies
10. Shell Programming and Scripting
What would be correct syntax in a script to check to see if a /export/nfs/home mount point is mounted and if not stop/abort? OS is Solaris 10 using standard VI ksh shell. Here is the script. Please tell me where you see the problem.
#!/bin/bash
#
# This script is run as root to sync AMI PROD... (0 Replies)
Discussion started by: soupbone38
0 Replies
LEARN ABOUT DEBIAN
stag-handle
STAG-HANDLE(1p) User Contributed Perl Documentation STAG-HANDLE(1p)
NAME
stag-handle - streams a stag file through a handler into a writer
SYNOPSIS
stag-handle -w itext -c my-handler.pl myfile.xml > processed.itext
stag-handle -w itext -p My::Parser -m My::Handler myfile.xml > processed.itext
DESCRIPTION
will take a Stag compatible format (xml, sxpr or itext), turn the data into an event stream passing it through my-handler.pl
ARGUMENTS
-help|h
shows this document
-module|m PERLMODULE
A module that is used to transform the input events the module should inherit from Data::Stag::BaseHandler
-unit|u NODE_NAME
(you should always use this option if you specify -m)
this is the unit that gets passed to the handler/transformer. this will get set automatically if you use the the -c, -s or -t options
multiple units can be set
-u foo -u bar -u boz
-writer|w WRITER
writer for final transformed tree; can be xml, sxpr or itext
-module|m MODULE
perl modules for handling events
-codefile|c FILE
a file containing a perlhashref containing event handlers - see below
-sub|s PERL
a perl hashref containing handlers
-trap|t ELEMENT=SUB
EXAMPLES
unix> cat my-handler.pl
{
person => sub {
my ($self, $person) = @_;
$person->set_fullname($person->get_firstname . ' ' .
$person->get_lastname);
$person;
},
address => sub {
my ($self, $address) = @_;
# remove addresses altogether from processed file
return;
},
}
perl v5.10.0 2008-12-23 STAG-HANDLE(1p)