Sql multi line comment /* shell interpretation issue
Greetings Experts,
I do have some basic knowledge of Unix. The task I am trying to do through shell script is to generate the view script for all of the tables which is in YYYYMMDD format (I assume I am on Ksh).
I have certain tables that ends in YYYYMMDD format (eg: tbl_20150630)
For each month, there is a table with respective YYYYMMDD (eg: tbl_20150131, tbl_20150228, ...., tbl_20150630). There are many different tables (tbl_2_20150131,.....,tbl_2_20150630)
For each table of the same class (tbl_20150131, tbl_20150228, ...., tbl_20150630), I need to create the view (not a plain select on table; using some case and other logics) (vw_tbl_20150131, vw_tbl_20150228,...,vw_tbl_20150630)
Sample view structure and expected output (should be until tbl_20150630): (For simplicity using minimal columns and 2 tables)
Approach I followed is to pass the view_name and the list of YYYYMMDD views to be created and have the view body separated into some files with below content.
selectpart1.txt:
yyyymmdd.txt: (please note that not all tables starts with 20150131; hence created them in separate file of valid values)
What I have tried is (courtesy of my friends) the below (may not be the exact one as I cannot copy paste) which works fine. ( I am in mydir directory)
When I execute the above shell script, could see wherever the comments are present in the selectpart1.txt ( /* ) , there are list of files displayed in the output of the above one, which I guess is due to shell interpretation of /* (all files in the directory). When I replace the contents of file selectpart1.txt where comments are there ( /* ) with -- it works.
selectpart1.txt:
and I get the output as expected. However, I prefer to retain the /* comments in the selectpart1.txt; How can I achieve this. Thanks for your time.
Note: I edit the selectpart1.txt to have the view body relative to the tables involved. (selectpart1.txt content doesn't change for vw_tbl_20150131, vw_tbl_20150228, ....., vw_tbl_20150630). But when the table class changes, I edit the selectpart1.txt accordingly which will be same for (vw_tbl_2_20150131, vw_tbl_2_20150228, ...., vw_tbl_2_20150630)
Hi Folks,
I am trying to generate a file with the C Cedilla delimiter.
I have a file that uses the below DML (In Dev region, the file that i am trying to generate):
decimal("Ç") acct_id; and so and so for new columns
When I cat this file I get below output:... (3 Replies)
Is there a quick and easy way to comment out multi lined print statements? something like this?
printf("3408 strings_line_tokens %s \n",
strings_line_tokens); (6 Replies)
Hello,
Currently, I am reading few queries from the below .sql file
--SOURCE TABLE NAME
--SOURCE QUERY
SEL COL1, COL2, COL3, COL4,
COL5, COL6, COL7 WHERE COL5 = '2015-11-04 16:24:00.000000' FROM SOURCE TABLE;
--TARGET TABLE NAME
--TARGET QUERY
SEL COLUMN1, COLUMN2, COLUMN3, COLUMN4,... (4 Replies)
Greetings Experts,
I need to handle the views created over monthly retention tables
for which every new table in YYYYMMDD format, there is
equivalent view created and the older table which might be
dropped, the view over it has to be re-created over a dummy
table so that it doesn't fail.... (2 Replies)
HI friends , i am also facing an issue in mysql
i ma trying to insert detail in a variable but not got success
#!/bin/sh
mysql -u<username> -p<password> <dbname> << EOF
DEV=`mysql --skip-column-names <dbname> -e "SELECT timestamp from process_record where id = 1"`
EOF
echo $DEV
ERROR... (3 Replies)
I have a file with data records separated by multiple equals signs, as below.
==========
RECORD 1
==========
RECORD 2
DATA LINE
==========
RECORD 3
==========
RECORD 4
DATA LINE
==========
RECORD 5
DATA LINE
==========
I need to filter out all data from this file where the... (2 Replies)
Hi,
I'm trying to run the following command using sh -c
ie
sh -c "while read EachLine
do
rm -f $EachLine ;
done < file_list.lst;"
It doesn't seem to do anything.
When I run this at the command line, it does remove the files contained in the list so i know the command works
ie... (4 Replies)
Hi, I am running a shell script on Compaq Tru64 UNIX V5.1A. I have attached the shill script with the sql script it is calling to extract some data(hyp_dta_Extr.sql), and the results. I need the file to be tab delimited. (please note that I have renamed hyp_dta_Extr.sql to hyp_dta_Extr.txt to... (1 Reply)
Requirement is:
1. comment and uncomment the line with Shell
Script: /opt/admin/fastpg/bin/fastpg.exe -c -=NET (using fastpg.exe as a search option)
2. display = "Commented" (when its commented) and display = "Uncommented" (when its uncommented)
Its urgent, please let me asap!!!
Thanks in... (2 Replies)