The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to redirect value from sql select statment to unix variable abdulhafeez Shell Programming and Scripting 17 10-22-2008 12:55 AM
if statment, based on retune value toliver182 Shell Programming and Scripting 1 05-16-2008 08:51 AM
Imitating DOS functionality: The Call Statment jadionne UNIX for Dummies Questions & Answers 21 12-25-2007 12:01 PM
what is wrong with my awk statment? hankooknara Shell Programming and Scripting 1 06-18-2007 11:27 PM
problem w/ -z && -n switches in an if statment Optimus_P Shell Programming and Scripting 1 07-31-2002 10:22 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 11-30-2006
baraka baraka is offline
Registered User
  
 

Join Date: Oct 2006
Posts: 6
hwo do I print ' in an awk statment?

hi 2 all,
I'm trying 2 print " ' " in an awk statement but the sign deosn't show.
The only way I came with is 2 declare the ' as a variable and call that variable.
I'm trying 2 do:
awk '{printf("insert into ba_memo_01 values ('%s');",$1)}'

and get the output:
insert into ba_memo_01 values ('627562');

thanks
  #2 (permalink)  
Old 11-30-2006
baraka baraka is offline
Registered User
  
 

Join Date: Oct 2006
Posts: 6
who do I print ' in an awk statement?

hi 2 all,
I'm trying 2 print " ' " in an awk statement but the sign deosn't show.
The only way I came with is 2 declare the ' as a variable and call that variable.
I'm trying 2 do:
awk '{printf("insert into ba_memo_01 values ('%s');",$1)}'

and get the output:
insert into ba_memo_01 values ('627562');

thanks
  #3 (permalink)  
Old 11-30-2006
ask.jackal ask.jackal is offline
Registered User
  
 

Join Date: Jan 2006
Posts: 24
awk '{print "insert into ba_memo_01 values('627562');"}'

works good for me

John
  #4 (permalink)  
Old 11-30-2006
baraka baraka is offline
Registered User
  
 

Join Date: Oct 2006
Posts: 6
it doesn't work it prints:
insert into ba_memo_01 values(627562);
withuot the '
  #5 (permalink)  
Old 11-30-2006
Ygor's Avatar
Ygor Ygor is offline Forum Staff  
Moderator
  
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,409
Try...
Code:
awk '{printf("insert into ba_memo_01 values (\047%s\047);",$1)}'
  #6 (permalink)  
Old 11-30-2006
baraka baraka is offline
Registered User
  
 

Join Date: Oct 2006
Posts: 6
Talking

thanks it worked beautifully
  #7 (permalink)  
Old 11-30-2006
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,953
Just a round about way,

modify the source file to hold quotes,
123 -> '123'
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 10:07 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