The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Double quotes or single quotes when using ssh? password636 Shell Programming and Scripting 3 05-29-2008 09:52 PM
awk to print ' (single quotes) orahi001 UNIX for Dummies Questions & Answers 2 03-11-2008 04:30 PM
echo using single quotes chella Shell Programming and Scripting 3 10-29-2007 12:54 AM
Checking Single Quotes in C janemary.a High Level Programming 3 06-07-2007 03:48 AM
im stuck! 'single quotes' satnamx UNIX for Dummies Questions & Answers 4 03-29-2006 07:44 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-30-2005
phani phani is offline
Registered User
  
 

Join Date: Mar 2005
Posts: 12
Filename containing Single Quotes

Hi ,
I am passing a variable site_name from a shellscript to an SQL script and then I want to spool an sql query on to my Unix box and generate a CSV file.
Everything works fine but I have to give quotes to the variable '&&site_name' in spool statement ..if i remove the quotes it generates an LST file or some other type of file.I am working on korn shell ..

pls help me remove the single quotes from my filename..I have tried many options but unable to resolve it...


define site_name=&&1
spool /projects/hpsd_dwh/global_extract/Closed_Case_Extract/MTD/'&&site_name'.csv

thanks in advance ...
cheers!!
  #2 (permalink)  
Old 03-30-2005
muthukumar muthukumar is offline
Registered User
  
 

Join Date: Feb 2005
Location: Coimbatore, Tamilnadu, India
Posts: 119
Can you tell us what do you want to from
define site_name=&&1
spool /projects/hpsd_dwh/global_extract/Closed_Case_Extract/MTD/'&&site_name'.csv?

It is good to give exact requirement to guide a solution to you?
  #3 (permalink)  
Old 03-30-2005
phani phani is offline
Registered User
  
 

Join Date: Mar 2005
Posts: 12
Hi Muthu,

I am sorry abt it.

this is my sql script..
---------------------------------
define site_name=&&1
spool /projects/hpsd_dwh/global_extract/Closed_Case_Extract/MTD/'&&site_name'.csv

select * from mytable;

spool off;
exit;
----------------------------------
using the spool statement I want to generate a CSV file.
But now the problem is the file which is getting generated has single quotes.
Which I don't want...and if I remove the quotes ....
CSV file is not getting generated..

I want a filename('&&sitename') without quotes....And the value for &&sitename is coming from a shell script...

Hope its clear..thnks a lot
  #4 (permalink)  
Old 03-30-2005
muthukumar muthukumar is offline
Registered User
  
 

Join Date: Feb 2005
Location: Coimbatore, Tamilnadu, India
Posts: 119
After creating CSV file quote using spool then rename that file with quote on shell??

We can remove ' as,

echo /projects/hpsd_dwh/global_extract/Closed_Case_Extract/MTD/'&&site_name'.csv | tr -d "'"
/projects/hpsd_dwh/global_extract/Closed_Case_Extract/MTD/&&site_name.csv

I hope it is ok. If i am wrong then give problem in this.
  #5 (permalink)  
Old 03-30-2005
phani phani is offline
Registered User
  
 

Join Date: Mar 2005
Posts: 12
Hi Muthu ,

thanks for being so fast...
will try this and let u know asap...

thnks a lot..
  #6 (permalink)  
Old 03-30-2005
ranj@tcs ranj@tcs is offline
Registered User
  
 

Join Date: Mar 2005
Posts: 5
Why dont you try &&1..csv in the spool filename.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:29 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0