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

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -