2022-03-24

System (awk) command saved as a variables error

I am having the following error:

a <- system("awk '{ if (/foo/) print "2","\t",$0; else print "1","\t",$0; }' file",intern=true)

However, I am getting the following error:

Error: unexpected numeric constant in "a \<- system("awk '{ if (/foo/) print "2"

I am wondering if I have to escape the internal apostrophe's but not sure how?!



No comments:

Post a Comment