Getting 2 kinds of quotes inside a pasted string
On Thu, Sep 11, 2003 at 10:12:56PM -0400, Wiener, Matthew wrote:
My problem is that I keep getting the quotes escaped in the string that
comes out, and that sets the field separator to something different.
What I'd like to end up with is something like:
awk 'BEGIN{FS=";"}'
If I can get this, I can put the rest of the awk program together. What I
actually keep getting is
awk 'BEGIN{FS=\";\"}'.
That is, the quote characters are escaped.
This prints what you want:
> print("awk \'BEGIN\{FS=\";\"\}\'")
[1] "awk 'BEGIN{FS=\";\"}'"
and I can pipe it into tee(1) which logs to its first argument:
> con<-pipe("tee /tmp/matt.log","w")
> cat("awk \'BEGIN\{FS=\";\"\}\'\n", file=con)
> awk 'BEGIN{FS=";"}' # this line echoes by tee
# pressed RETURN
> close(con)
and it all looks fine:
edd at chibud:~> cat /tmp/matt.log
awk 'BEGIN{FS=";"}'
edd at chibud:~>
Hth, Dirk
Those are my principles, and if you don't like them... well, I have others.
-- Groucho Marx