Skip to content
Prev 37171 / 398500 Next

Getting 2 kinds of quotes inside a pasted string

On Thu, Sep 11, 2003 at 10:12:56PM -0400, Wiener, Matthew wrote:
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