groovy ant execute with pipeTo -
i trying use awk pipeto , need syntax.
this works:
def myid = 'myid' print "ls -al".execute().pipeto("grep ${myid}".execute()).text
this fails:
print "ls -al".execute().pipeto('awk \'{print $2}\''.execute()).text print "ls -al".execute().pipeto('''awk '{print $2}' '''.execute()).text
you may want try removing space between print
, \$1
:
p1="ls -la".execute() p2='awk {print\$1}'.execute() p1 | p2 p2.waitfor() print p2.text
note p2.err.text
contain error messages, if (useful if p2.text
blank).
Comments
Post a Comment