• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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: 7125
184
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 ?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic