Why doesn't the single quote charater show up in my printf statements output??

Why doesn't the single quote charater show up in my printf statements output??

Post by bman.. » Wed, 16 May 2001 05:25:18



hi,

Using the following line in my awk program doesn't yield the single
quote i am looking for in my output:

 printf("delete from  bin_inv where (serial_nbr = RTRIM('%s'))

i also tried
 printf("delete from  bin_inv where (serial_nbr = RTRIM(\'%s\'))

but that complains bout the printf statement syntax.

I am using a HP box in these examples.

Thanks in advance..

 
 
 

Why doesn't the single quote charater show up in my printf statements output??

Post by John Gord » Wed, 16 May 2001 05:30:54



> --------------786C72799CD8C5E24F85C7B5
> Content-Type: text/html; charset=us-ascii
> Content-Transfer-Encoding: 7bit
> <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> <html>

please don't post in HTML.

Quote:> hi,
> Using the following line in my awk program doesn't yield the single
> quote i am looking for in my output:
>  printf("delete from  bin_inv where (serial_nbr = RTRIM('%s'))
> i also tried
>  printf("delete from  bin_inv where (serial_nbr = RTRIM(\'%s\'))
> but that complains bout the printf statement syntax.

both of these examples are missing a closing double-quote.

---
"... What with you being his parents and all, I think that you could
be trusted not to shaft him."  -- Robert Chang, rec.games.board



 
 
 

Why doesn't the single quote charater show up in my printf statements output??

Post by Kevin Lacquemen » Wed, 16 May 2001 05:54:48


    b> hi,
    b> Using the following line in my awk program doesn't yield the single
    b> quote i am looking for in my output:

    b>  printf("delete from  bin_inv where (serial_nbr = RTRIM('%s'))

You seem to be missing four things from this statement:
  a) Closing quote
  b) String to sub into %s
  c) Closing paren for the printf
  d) Following semicolon

Eg:
printf("delete from bin_inv where (serial_nbr = RTRIM('%s'))", foo);

Where foo is an initialized string

[...]

Cheers,
Kevin

--
He that breaks a thing to find out what it is has left the path of
wisdom                                         -- Gandalf the Grey

 
 
 

Why doesn't the single quote charater show up in my printf statements output??

Post by Dan Merc » Wed, 16 May 2001 07:05:44





>     b> hi,
>     b> Using the following line in my awk program doesn't yield the single
>     b> quote i am looking for in my output:

>     b>  printf("delete from  bin_inv where (serial_nbr = RTRIM('%s'))

> You seem to be missing four things from this statement:
>   a) Closing quote
>   b) String to sub into %s
>   c) Closing paren for the printf
>   d) Following semicolon

Semicolons are only necessary when you want more than one
statement on a line.  Printf statements do not take parentheses -
you can use them,  but they are treated as any other parenthetical
statement.  They can mask problems.  Awk isn't 'C'.

--
Dan Mercer

Quote:

> Eg:
> printf("delete from bin_inv where (serial_nbr = RTRIM('%s'))", foo);

> Where foo is an initialized string

> [...]

> Cheers,
> Kevin

Opinions expressed herein are my own and may not represent those of my employer.
 
 
 

Why doesn't the single quote charater show up in my printf statements output??

Post by Kevin Lacquemen » Wed, 16 May 2001 08:02:41


[...]

    DM> Semicolons are only necessary when you want more than one
    DM> statement on a line.  Printf statements do not take parentheses -
    DM> you can use them,  but they are treated as any other parenthetical
    DM> statement.  They can mask problems.  Awk isn't 'C'.

<remove foot from mouth>
Hmm...next time I should read all the words.  I missed the 'awk' part.
<replace foot in mouth>

[...]

Cheers,
Kevin

--
He that breaks a thing to find out what it is has left the path of
wisdom                                         -- Gandalf the Grey

 
 
 

Why doesn't the single quote charater show up in my printf statements output??

Post by Kenny McCorma » Mon, 30 Jul 2001 01:27:38


...

Quote:>> You seem to be missing four things from this statement:
>>   a) Closing quote
>>   b) String to sub into %s
>>   c) Closing paren for the printf
>>   d) Following semicolon

>Semicolons are only necessary when you want more than one
>statement on a line.  Printf statements do not take parentheses -
>you can use them,  but they are treated as any other parenthetical
>statement.  They can mask problems.  Awk isn't 'C'.

Agreed on everything except the part about parens and printf.  I agree that
AWK isn't C, but the printf statement, both in appearance and function, is
almost identical to C.

The problem is that w/o the parens, the following is ambiguous:

        printf "%d",$1 > $2

For this reason, I got in the habit of always using parens with printf.

 
 
 

1. printf doesn't show any output under cygwin bash shell

Hi

Why trying to print out messages using printf does't produce any output
under bash/cygwin (it works though under cmd.exe).
Printing with "cout << " works anywhere. Is there something I can fix
on my PC (WinXP) or it's a known problem?
I started to see the problem when my clisp output didn't print anything
in emacs (which uses bash shell), I took a look a the clisp code and
saw that they use printf to print out.

Thank you,
Andrei

2. Quick awk question

3. replace single quote by escaped single quote

4. Java Interpreter for Sys Admins ??

5. Problems redirection output from printf statement to /dev/stderr

6. Need help w/ PPP

7. replacing printf with my printf, then calling C lib's printf

8. FTP home directory restriction...

9. Solaris 7 last command output doesn't show the full name of host

10. Shape Ups,Men's Shape Ups,Men's Skechers Shape Ups - new styles!

11. Linux: who/last/finger doesn't show the correct output

12. Why doesn't KDE show a complete list of dictionary files?

13. Why doesn't the GnoRPM screen show up