• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

execute grep command line in groovy script matching multiple words

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could anyone help understand as to why this code snipped has the error below ?



grep: Movie: No such file or directory
grep: Theatre': No such file or directory

In other words, it does not seem to be able to understand the spaces in between words. I have tried [[:space]] and also \s with the option -e, but still same issue

I have also tried

But same error:
Cannot run program "grep "Selected Movie Theatre Number" -A 5 filename
Caused by: java.io.IOException: error=2, No such file or directory

 
Sheriff
Posts: 7126
185
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
With grep, options come before the pattern:

grep [OPTIONS] PATTERN [FILE...]

So try

"grep -A 5 \"Selected Movie Theatre Number\" ${currentFile.getAbsolutePath()}"
 
Grace Green
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Thank you for your reply, but it did not make any difference.
Instead, this worked:

No other way worked.

Now, the loop in which this commend is executed hangs ... maybe I should close the proc or process ?
 
Everyone is a villain in someone else's story. Especially this devious tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic