2

I am having problem with the find and grep commands. I want to find the files which are *.doc and match the pattern Danish from that file with grep command. I am using -exec to combine them but it give an error i do not know what is that. It said that the -exec argument is missing.

screen shot

3
  • 4
    Please don't post screenshots of text. Copy the text here and apply code formatting. And there should be a space between {} and + or ;.
    – muru
    Feb 1, 2016 at 7:04
  • And if you're using ; escape it: \;.
    – kos
    Feb 1, 2016 at 7:08
  • That's a typical beginner's mistake which I also made quite a few times until I found that out... ;-)
    – Byte Commander
    Feb 1, 2016 at 7:17

2 Answers 2

8

You have to escape the ;:

find -iname .... -exec echo {} \;

Will do what you want.

1
  • 4
    The space before it is also mandatory, otherwise you get the same error.
    – kos
    Feb 1, 2016 at 7:11
2

Unless you put a backslash before the ;, the shell will interpret that as a command separator, not as an argument to find command.

1
  • 2
    And a space before it, otherwise you get the same error.
    – kos
    Feb 1, 2016 at 7:12

Not the answer you're looking for? Browse other questions tagged .